Skip to content

Commit c9c1eef

Browse files
committed
[AMDGPU][Verifier] Check address space of alloca instruction
1 parent f87109f commit c9c1eef

File tree

11 files changed

+4002
-3280
lines changed

11 files changed

+4002
-3280
lines changed

llvm/lib/IR/Verifier.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4392,6 +4392,11 @@ void Verifier::visitAllocaInst(AllocaInst &AI) {
43924392
verifySwiftErrorValue(&AI);
43934393
}
43944394

4395+
if (TT.isAMDGPU()) {
4396+
Check(AI.getAddressSpace() == DL.getAllocaAddrSpace(),
4397+
"alloca on amdgpu must be in addrspace(5)", &AI);
4398+
}
4399+
43954400
visitInstruction(AI);
43964401
}
43974402

llvm/test/CodeGen/AMDGPU/assert-wrong-alloca-addrspace.ll

Lines changed: 0 additions & 16 deletions
This file was deleted.

llvm/test/CodeGen/AMDGPU/lower-indirect-lds-references.ll

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ define amdgpu_kernel void @offloading_kernel() {
1616
}
1717

1818
define void @call_unknown() {
19-
%1 = alloca ptr, align 8
20-
%2 = call i32 %1()
19+
%alloca = alloca ptr, align 8, addrspace(5)
20+
%alloca.cast = addrspacecast ptr addrspace(5) %alloca to ptr
21+
%ret = call i32 %alloca.cast()
2122
ret void
2223
}
2324

llvm/test/Transforms/InstCombine/alloca-in-non-alloca-as.ll

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)