diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -3801,11 +3801,6 @@ void Verifier::visitAllocaInst(AllocaInst &AI) { SmallPtrSet Visited; - PointerType *PTy = AI.getType(); - // TODO: Relax this restriction? - Assert(PTy->getAddressSpace() == DL.getAllocaAddrSpace(), - "Allocation instruction pointer not in the stack address space!", - &AI); Assert(AI.getAllocatedType()->isSized(&Visited), "Cannot allocate unsized type", &AI); Assert(AI.getArraySize()->getType()->isIntegerTy(), diff --git a/llvm/test/Assembler/datalayout-alloca-addrspace-mismatch-0.ll b/llvm/test/Assembler/datalayout-alloca-addrspace-mismatch-0.ll deleted file mode 100644 --- a/llvm/test/Assembler/datalayout-alloca-addrspace-mismatch-0.ll +++ /dev/null @@ -1,11 +0,0 @@ -; RUN: not llvm-as < %s 2>&1 | FileCheck %s - -target datalayout = "A1" - -; CHECK: Allocation instruction pointer not in the stack address space! -; CHECK-NEXT: %alloca_scalar_no_align = alloca i32, align 4, addrspace(2) - -define void @use_alloca() { - %alloca_scalar_no_align = alloca i32, addrspace(2) - ret void -} diff --git a/llvm/test/Assembler/datalayout-alloca-addrspace-mismatch-1.ll b/llvm/test/Assembler/datalayout-alloca-addrspace-mismatch-1.ll deleted file mode 100644 --- a/llvm/test/Assembler/datalayout-alloca-addrspace-mismatch-1.ll +++ /dev/null @@ -1,11 +0,0 @@ -; RUN: not llvm-as < %s 2>&1 | FileCheck %s - -target datalayout = "A1" - -; CHECK: Allocation instruction pointer not in the stack address space! -; CHECK-NEXT: %alloca_scalar_no_align = alloca i32, align 4, addrspace(2) - -define void @use_alloca() { - %alloca_scalar_no_align = alloca i32, align 4, addrspace(2) - ret void -} diff --git a/llvm/test/Assembler/datalayout-alloca-addrspace-mismatch-2.ll b/llvm/test/Assembler/datalayout-alloca-addrspace-mismatch-2.ll deleted file mode 100644 --- a/llvm/test/Assembler/datalayout-alloca-addrspace-mismatch-2.ll +++ /dev/null @@ -1,13 +0,0 @@ -; RUN: not llvm-as < %s 2>&1 | FileCheck %s - -target datalayout = "A1" - -; CHECK: Allocation instruction pointer not in the stack address space! -; CHECK-NEXT: %alloca_scalar_no_align = alloca i32, align 4, addrspace(2), !foo !0 - -define void @use_alloca() { - %alloca_scalar_no_align = alloca i32, align 4, addrspace(2), !foo !0 - ret void -} - -!0 = !{} diff --git a/llvm/test/Verifier/alloca-alternate-addrspace-valid.ll b/llvm/test/Verifier/alloca-alternate-addrspace-valid.ll new file mode 100644 --- /dev/null +++ b/llvm/test/Verifier/alloca-alternate-addrspace-valid.ll @@ -0,0 +1,22 @@ +; RUN: llvm-as %s -o /dev/null + +; Should assemble without error. + +target datalayout = "A1" + +define void @use_alloca0() { + %alloca_scalar_no_align = alloca i32, addrspace(2) + ret void +} + +define void @use_alloca1() { + %alloca_scalar_no_align = alloca i32, align 4, addrspace(2) + ret void +} + +define void @use_alloca2() { + %alloca_scalar_no_align = alloca i32, align 4, addrspace(2), !foo !0 + ret void +} + +!0 = !{}