[PATCH] D20726: [BPF] Remove exit-on-error from tests (PR27768, PR27769)

Diana Picus via llvm-commits llvm-commits at lists.llvm.org
Fri May 27 04:58:23 PDT 2016


rovka created this revision.
rovka added a reviewer: ast.
rovka added subscribers: llvm-commits, rengolin.

The exit-on-error flag is necessary to avoid some assertions/unreachables. We can get past them by creating a few dummy nodes.

Fixes PR27768, PR27769.

Last patch removing exit-on-error on the BPF side :)

http://reviews.llvm.org/D20726

Files:
  lib/Target/BPF/BPFISelLowering.cpp
  test/CodeGen/BPF/struct_ret1.ll
  test/CodeGen/BPF/struct_ret2.ll

Index: test/CodeGen/BPF/struct_ret2.ll
===================================================================
--- test/CodeGen/BPF/struct_ret2.ll
+++ test/CodeGen/BPF/struct_ret2.ll
@@ -1,4 +1,4 @@
-; RUN: not llc -march=bpf -exit-on-error < %s 2> %t1
+; RUN: not llc -march=bpf < %s 2> %t1
 ; RUN: FileCheck %s < %t1
 ; CHECK: only small returns
 
Index: test/CodeGen/BPF/struct_ret1.ll
===================================================================
--- test/CodeGen/BPF/struct_ret1.ll
+++ test/CodeGen/BPF/struct_ret1.ll
@@ -1,4 +1,4 @@
-; RUN: not llc -march=bpf -exit-on-error < %s 2> %t1
+; RUN: not llc -march=bpf < %s 2> %t1
 ; RUN: FileCheck %s < %t1
 ; CHECK: only integer returns
 
Index: lib/Target/BPF/BPFISelLowering.cpp
===================================================================
--- lib/Target/BPF/BPFISelLowering.cpp
+++ lib/Target/BPF/BPFISelLowering.cpp
@@ -346,6 +346,7 @@
                                const SmallVectorImpl<ISD::OutputArg> &Outs,
                                const SmallVectorImpl<SDValue> &OutVals,
                                SDLoc DL, SelectionDAG &DAG) const {
+  unsigned Opc = BPFISD::RET_FLAG;
 
   // CCValAssign - represent the assignment of the return value to a location
   SmallVector<CCValAssign, 16> RVLocs;
@@ -356,6 +357,7 @@
 
   if (MF.getFunction()->getReturnType()->isAggregateType()) {
     fail(DL, DAG, "only integer returns supported");
+    return DAG.getNode(Opc, DL, MVT::Other, Chain);
   }
 
   // Analize return values.
@@ -377,7 +379,6 @@
     RetOps.push_back(DAG.getRegister(VA.getLocReg(), VA.getLocVT()));
   }
 
-  unsigned Opc = BPFISD::RET_FLAG;
   RetOps[0] = Chain; // Update chain.
 
   // Add the flag if we have it.
@@ -399,6 +400,9 @@
 
   if (Ins.size() >= 2) {
     fail(DL, DAG, "only small returns supported");
+    for (unsigned i = 0, e = Ins.size(); i != e; ++i)
+      InVals.push_back(DAG.getConstant(0, DL, Ins[i].VT));
+    return DAG.getCopyFromReg(Chain, DL, 1, Ins[0].VT, InFlag).getValue(1);
   }
 
   CCInfo.AnalyzeCallResult(Ins, RetCC_BPF64);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20726.58769.patch
Type: text/x-patch
Size: 2061 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160527/7ac7ea44/attachment.bin>


More information about the llvm-commits mailing list