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

Chris Lattner sabre at nondot.org
Tue Apr 10 23:43:42 PDT 2007



Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.287 -> 1.288
---
Log message:

don't create shifts by zero, fix some problems with my previous patch


---
Diffs of the changes:  (+7 -3)

 DAGCombiner.cpp |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.287 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.288
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.287	Wed Apr 11 00:32:27 2007
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp	Wed Apr 11 01:43:25 2007
@@ -2136,7 +2136,7 @@
     SimplifySelectCC(N0.getOperand(0), N0.getOperand(1),
                      DAG.getConstant(~0ULL, VT), DAG.getConstant(0, VT),
                      cast<CondCodeSDNode>(N0.getOperand(2))->get());
-    if (SCC.Val) return SCC;
+    if (SCC.Val && SCC.Val != N) return SCC;
   }
   
   return SDOperand();
@@ -2226,7 +2226,7 @@
       SimplifySelectCC(N0.getOperand(0), N0.getOperand(1),
                        DAG.getConstant(1, VT), DAG.getConstant(0, VT),
                        cast<CondCodeSDNode>(N0.getOperand(2))->get());
-    if (SCC.Val) return SCC;
+    if (SCC.Val && SCC.Val != N) return SCC;
   }
   
   return SDOperand();
@@ -2320,7 +2320,8 @@
     SimplifySelectCC(N0.getOperand(0), N0.getOperand(1),
                      DAG.getConstant(1, VT), DAG.getConstant(0, VT),
                      cast<CondCodeSDNode>(N0.getOperand(2))->get());
-    if (SCC.Val) return SCC;
+    if (SCC.Val && SCC.Val != N && SCC.getOpcode() != ISD::ZERO_EXTEND)
+      return SCC;
   }
   
   return SDOperand();
@@ -4139,6 +4140,9 @@
     }
     AddToWorkList(SCC.Val);
     AddToWorkList(Temp.Val);
+    
+    if (N2C->getValue() == 1)
+      return Temp;
     // shl setcc result by log2 n2c
     return DAG.getNode(ISD::SHL, N2.getValueType(), Temp,
                        DAG.getConstant(Log2_64(N2C->getValue()),






More information about the llvm-commits mailing list