Index: llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp =================================================================== --- llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp +++ llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp @@ -690,7 +690,8 @@ DiagnosticInfoUnsupported NoDynamicAlloca(Fn, "unsupported dynamic alloca", SDLoc(Op).getDebugLoc()); DAG.getContext()->diagnose(NoDynamicAlloca); - return SDValue(); + auto Ops = {DAG.getConstant(0, SDLoc(), Op.getValueType()), Op.getOperand(0)}; + return DAG.getMergeValues(Ops, SDLoc()); } SDValue AMDGPUTargetLowering::LowerOperation(SDValue Op, Index: llvm/trunk/lib/Target/AMDGPU/AMDGPUInstrInfo.cpp =================================================================== --- llvm/trunk/lib/Target/AMDGPU/AMDGPUInstrInfo.cpp +++ llvm/trunk/lib/Target/AMDGPU/AMDGPUInstrInfo.cpp @@ -103,7 +103,9 @@ const MachineFrameInfo *MFI = MF.getFrameInfo(); // Variable sized objects are not supported - assert(!MFI->hasVarSizedObjects()); + if (MFI->hasVarSizedObjects()) { + return -1; + } if (MFI->getNumObjects() == 0) { return -1; Index: llvm/trunk/test/CodeGen/AMDGPU/dynamic_stackalloc.ll =================================================================== --- llvm/trunk/test/CodeGen/AMDGPU/dynamic_stackalloc.ll +++ llvm/trunk/test/CodeGen/AMDGPU/dynamic_stackalloc.ll @@ -1,6 +1,6 @@ -; RUN: not llc -march=amdgcn -mcpu=tahiti -mattr=+promote-alloca -verify-machineinstrs -exit-on-error < %s 2>&1 | FileCheck %s -; RUN: not llc -march=amdgcn -mcpu=tahiti -mattr=-promote-alloca -verify-machineinstrs -exit-on-error < %s 2>&1 | FileCheck %s -; RUN: not llc -march=r600 -mcpu=cypress -exit-on-error < %s 2>&1 | FileCheck %s +; RUN: not llc -march=amdgcn -mcpu=tahiti -mattr=+promote-alloca -verify-machineinstrs < %s 2>&1 | FileCheck %s +; RUN: not llc -march=amdgcn -mcpu=tahiti -mattr=-promote-alloca -verify-machineinstrs < %s 2>&1 | FileCheck %s +; RUN: not llc -march=r600 -mcpu=cypress < %s 2>&1 | FileCheck %s ; CHECK: in function test_dynamic_stackalloc{{.*}}: unsupported dynamic alloca Index: llvm/trunk/test/CodeGen/AMDGPU/private-memory-broken.ll =================================================================== --- llvm/trunk/test/CodeGen/AMDGPU/private-memory-broken.ll +++ llvm/trunk/test/CodeGen/AMDGPU/private-memory-broken.ll @@ -1,5 +1,5 @@ -; RUN: not llc -verify-machineinstrs -march=amdgcn -mcpu=SI -exit-on-error %s -o /dev/null 2>&1 | FileCheck %s -; RUN: not llc -verify-machineinstrs -march=amdgcn -mcpu=tonga -exit-on-error %s -o /dev/null 2>&1 | FileCheck %s +; RUN: not llc -verify-machineinstrs -march=amdgcn %s -o /dev/null 2>&1 | FileCheck %s +; RUN: not llc -verify-machineinstrs -march=amdgcn -mcpu=tonga %s -o /dev/null 2>&1 | FileCheck %s ; Make sure promote alloca pass doesn't crash Index: llvm/trunk/test/CodeGen/AMDGPU/promote-alloca-bitcast-function.ll =================================================================== --- llvm/trunk/test/CodeGen/AMDGPU/promote-alloca-bitcast-function.ll +++ llvm/trunk/test/CodeGen/AMDGPU/promote-alloca-bitcast-function.ll @@ -1,4 +1,4 @@ -; RUN: not llc -march=amdgcn -exit-on-error < %s 2>&1 | FileCheck %s +; RUN: not llc -march=amdgcn < %s 2>&1 | FileCheck %s ; Make sure that AMDGPUPromoteAlloca doesn't crash if the called ; function is a constantexpr cast of a function. @@ -13,6 +13,7 @@ ret void } +; CHECK: in function crash_call_constexpr_cast{{.*}}: unsupported call to function foo.varargs define void @crash_call_constexpr_cast_varargs() #0 { %alloca = alloca i32 call void bitcast (void (...)* @foo.varargs to void (i32*)*)(i32* %alloca) #0