[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Sep 9 16:00:23 PDT 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAG.cpp updated: 1.191 -> 1.192
---
Log message:

Fix a problem duraid encountered on itanium where this folding:
select (x < y), 1, 0 -> (x < y) incorrectly: the setcc returns i1 but the
select returned i32.  Add the zero extend as needed.


---
Diffs of the changes:  (+6 -2)

 SelectionDAG.cpp |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.191 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.192
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.191	Fri Sep  9 17:35:03 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp	Fri Sep  9 18:00:07 2005
@@ -974,8 +974,12 @@
   // Check to see if this is the equivalent of setcc
   if (N4C && N4C->isNullValue() && N3C && (N3C->getValue() == 1ULL)) {
     MVT::ValueType XType = N1.getValueType();
-    if (TLI.isOperationLegal(ISD::SETCC, TLI.getSetCCResultTy()))
-      return getSetCC(TLI.getSetCCResultTy(), N1, N2, CC);
+    if (TLI.isOperationLegal(ISD::SETCC, TLI.getSetCCResultTy())) {
+      SDOperand Res = getSetCC(TLI.getSetCCResultTy(), N1, N2, CC);
+      if (Res.getValueType() != VT)
+        Res = getNode(ISD::ZERO_EXTEND, VT, Res);
+      return Res;
+    }
 
     // seteq X, 0 -> srl (ctlz X, log2(size(X)))
     if (N2C && N2C->isNullValue() && CC == ISD::SETEQ && 






More information about the llvm-commits mailing list