]> granicus.if.org Git - llvm/commitdiff
[AMDGPU] Remove exit-on-error in test (PR27761)
authorDiana Picus <diana.picus@linaro.org>
Thu, 23 Jun 2016 09:19:16 +0000 (09:19 +0000)
committerDiana Picus <diana.picus@linaro.org>
Thu, 23 Jun 2016 09:19:16 +0000 (09:19 +0000)
The exit-on-error flag was necessary in order to avoid an assertion when
handling DYNAMIC_STACKALLOC nodes in SelectionDAGLegalize.

We can avoid the assertion by creating some dummy nodes. This enables us to
remove the exit-on-error flag on the first 2 run lines (SI), but on the third
run line (R600) we would run into another assertion when trying to reserve
indirect registers. This patch also replaces that assertion with an early exit
from the function.

Fixes PR27761.

Differential Revision: http://reviews.llvm.org/D20852

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273550 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AMDGPU/AMDGPUISelLowering.cpp
lib/Target/AMDGPU/AMDGPUInstrInfo.cpp
test/CodeGen/AMDGPU/dynamic_stackalloc.ll
test/CodeGen/AMDGPU/private-memory-broken.ll
test/CodeGen/AMDGPU/promote-alloca-bitcast-function.ll

index 942346c6d8f824edc9aaf0c82e3819babdf5e3b2..ddc86da742f2aca27dc4cc543b957f43b67fd290 100644 (file)
@@ -690,7 +690,8 @@ SDValue AMDGPUTargetLowering::LowerDYNAMIC_STACKALLOC(SDValue Op,
   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 0fe3b6845f4570a2f22d31d177beec8d9e220952..60dba1a063ace862ba604efcaee82abc805199dc 100644 (file)
@@ -103,7 +103,9 @@ int AMDGPUInstrInfo::getIndirectIndexEnd(const MachineFunction &MF) const {
   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 5d2305600fbd3ea286625833e5258c7231585970..580dc00f935e7618b055c42b22eee7d881b85b5f 100644 (file)
@@ -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 17a54c70fcf049eb92f6847a8bf622158b33add5..8ba0b70dbdbb59642ca1a93bc0ec5c57b72f9574 100644 (file)
@@ -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 095996d8e10f27f466b48a7aff2effe9100198e7..82030f377d9f8384e93634f9ef308c5b94ee9623 100644 (file)
@@ -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 @@ define void @crash_call_constexpr_cast() #0 {
   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