[PATCH] D20852: [AMDGPU] Remove exit-on-error in test (PR27761)

Diana Picus via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 1 01:15:06 PDT 2016


rovka created this revision.
rovka added reviewers: arsenm, tstellarAMD.
rovka added subscribers: llvm-commits, rengolin.
Herald added subscribers: kzhuravl, arsenm.

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.

Last exit-on-error patch for AMDGPU

http://reviews.llvm.org/D20852

Files:
  lib/Target/AMDGPU/AMDGPUISelLowering.cpp
  lib/Target/AMDGPU/AMDGPUInstrInfo.cpp
  test/CodeGen/AMDGPU/dynamic_stackalloc.ll

Index: test/CodeGen/AMDGPU/dynamic_stackalloc.ll
===================================================================
--- test/CodeGen/AMDGPU/dynamic_stackalloc.ll
+++ 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: lib/Target/AMDGPU/AMDGPUInstrInfo.cpp
===================================================================
--- lib/Target/AMDGPU/AMDGPUInstrInfo.cpp
+++ 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: lib/Target/AMDGPU/AMDGPUISelLowering.cpp
===================================================================
--- lib/Target/AMDGPU/AMDGPUISelLowering.cpp
+++ lib/Target/AMDGPU/AMDGPUISelLowering.cpp
@@ -689,7 +689,8 @@
   DiagnosticInfoUnsupported NoDynamicAlloca(Fn, "unsupported dynamic alloca",
                                             SDLoc(Op).getDebugLoc());
   DAG.getContext()->diagnose(NoDynamicAlloca);
-  return SDValue();
+  auto Ops = {DAG.getIntPtrConstant(0, SDLoc()), Op.getOperand(0)};
+  return DAG.getMergeValues(Ops, SDLoc());
 }
 
 SDValue AMDGPUTargetLowering::LowerOperation(SDValue Op,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20852.59177.patch
Type: text/x-patch
Size: 2029 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160601/dc51f8cb/attachment.bin>


More information about the llvm-commits mailing list