Skip to content

Commit

Permalink
Skip function declarations in the SLM resolution pass
Browse files Browse the repository at this point in the history
Function declarations have no basic blocks and instructions, so they
should be skipped in the SLM resolution pass.
  • Loading branch information
vmustya authored and igcbot committed Nov 28, 2024
1 parent 1be6116 commit 3db59df
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion IGC/VectorCompiler/lib/GenXCodeGen/GenXSLMResolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,12 @@ bool GenXSLMResolution::runOnModule(Module &M) {

auto SLMVars = collectSLMVariables(M);
if (!SLMVars.empty())
for (auto &F : M.functions())
for (auto &F : M.functions()) {
if (F.isDeclaration())
continue;
Modified |=
vc::breakConstantExprs(&F, vc::LegalizationStage::NotLegalized);
}

for (auto &F : M.functions())
if (vc::isKernel(&F))
Expand Down
7 changes: 7 additions & 0 deletions IGC/VectorCompiler/test/GenXSLMResolution/simple.ll
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,20 @@ define dllexport spir_kernel void @kernel() #0 {
; CHECK-OPAQUE-PTRS: %load_struct_i64i8 = load { i64, i8 }, ptr addrspace(3) inttoptr (i32 8 to ptr addrspace(3))
%load_struct_i64i8 = load { i64, i8 }, { i64, i8 } addrspace(3)* @slm_struct_i64i8

; CHECK-TYPED-PTRS: call void @llvm.genx.barrier()
; CHECK-OPAQUE-PTRS: call void @llvm.genx.barrier()
call void @llvm.genx.barrier()

; CHECK-TYPED-PTRS: %load_struct_align = load { i1 }, { i1 } addrspace(3)* inttoptr (i32 268435456 to { i1 } addrspace(3)*)
; CHECK-OPAQUE-PTRS: %load_struct_align = load { i1 }, ptr addrspace(3) inttoptr (i32 268435456 to ptr addrspace(3))
%load_struct_align = load { i1 }, { i1 } addrspace(3)* @slm_struct_align
ret void
}

declare void @llvm.genx.barrier() #1

attributes #0 = { noinline nounwind "CMGenxMain" }
attributes #1 = { nounwind convergent }

!genx.kernels = !{!0}
!genx.kernel.internal = !{!3}
Expand Down

0 comments on commit 3db59df

Please sign in to comment.