[llvm-commits] [llvm] r57968 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp

Duncan Sands baldrick at free.fr
Wed Oct 22 02:23:20 PDT 2008


Author: baldrick
Date: Wed Oct 22 04:23:20 2008
New Revision: 57968

URL: http://llvm.org/viewvc/llvm-project?rev=57968&view=rev
Log:
Be nice to CellSPU: for this target getSetCCResultType
may return i8, which can result in SELECT nodes for
which the type of the condition is i8, but there are
no patterns for select with i8 condition.  Tweak the
LegalizeTypes logic to avoid this as much as possible.
This isn't a real fix because it is still perfectly
possible to end up with such select nodes - CellSPU
needs to be fixed IMHO.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp?rev=57968&r1=57967&r2=57968&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Wed Oct 22 04:23:20 2008
@@ -811,10 +811,16 @@
   SDValue Cond = GetPromotedInteger(N->getOperand(0));
 
   // Promote all the way up to SVT, the canonical SetCC type.
-  MVT SVT = TLI.getSetCCResultType(Cond);
+  // FIXME: Not clear what value to pass to getSetCCResultType.
+  // [This only matters for CellSPU since all other targets
+  // ignore the argument.]  We used to pass Cond, resulting in
+  // SVT = MVT::i8, but CellSPU has no select patterns for i8,
+  // causing an abort later.  Passing the result type works
+  // around the problem.
+  MVT SVT = TLI.getSetCCResultType(N->getOperand(1));
   assert(isTypeLegal(SVT) && "Illegal SetCC type!");
   assert(Cond.getValueSizeInBits() <= SVT.getSizeInBits() &&
-         "Integer type overpromoted?");
+         "Unexpected SetCC type!");
 
   // Make sure the extra bits conform to getSetCCResultContents.  There are
   // two sets of extra bits: those in Cond, which come from type promotion,





More information about the llvm-commits mailing list