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

Chris Lattner lattner at cs.uiuc.edu
Tue Oct 4 21:45:55 PDT 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.14 -> 1.15
---
Log message:

Fix a crash compiling Olden/tsp


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

 DAGCombiner.cpp |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.14 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.15
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.14	Wed Sep 28 17:28:18 2005
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp	Tue Oct  4 23:45:43 2005
@@ -1069,18 +1069,16 @@
   
   // Determine if the condition we're dealing with is constant
   SDOperand SCC = SimplifySetCC(TLI.getSetCCResultTy(), N0, N1, CC);
-  ConstantSDNode *SCCC = dyn_cast<ConstantSDNode>(SCC);
-  bool constTrue = SCCC && SCCC->getValue() == 1;
-  bool constFalse = SCCC && SCCC->isNullValue();
-    
+  ConstantSDNode *SCCC = dyn_cast_or_null<ConstantSDNode>(SCC.Val);
+  
   // fold select_cc lhs, rhs, x, x, cc -> x
   if (N2 == N3)
     return N2;
   // fold select_cc true, x, y -> x
-  if (constTrue)
+  if (SCCC && SCCC->getValue())
     return N2;
   // fold select_cc false, x, y -> y
-  if (constFalse)
+  if (SCCC && SCCC->getValue() == 0)
     return N3;
   // fold select_cc into other things, such as min/max/abs
   return SimplifySelectCC(N0, N1, N2, N3, CC);






More information about the llvm-commits mailing list