Skip to content

Commit 47f6fb1

Browse files
committed
[AMDGPU][Verifier] Check address space of alloca instruction
1 parent c7fae59 commit 47f6fb1

File tree

10 files changed

+3999
-3278
lines changed

10 files changed

+3999
-3278
lines changed

llvm/lib/IR/Verifier.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4395,6 +4395,11 @@ void Verifier::visitAllocaInst(AllocaInst &AI) {
43954395
verifySwiftErrorValue(&AI);
43964396
}
43974397

4398+
if (TT.isAMDGPU()) {
4399+
Check(AI.getAddressSpace() == DL.getAllocaAddrSpace(),
4400+
"alloca on amdgpu must be in addrspace(5)", &AI);
4401+
}
4402+
43984403
visitInstruction(AI);
43994404
}
44004405

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)