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

Chris Lattner lattner at cs.uiuc.edu
Thu May 4 23:32:16 PDT 2006



Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.155 -> 1.156
---
Log message:

Fold some common code.


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

 DAGCombiner.cpp |   16 ++--------------
 1 files changed, 2 insertions(+), 14 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.155 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.156
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.155	Fri May  5 01:31:05 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp	Fri May  5 01:32:04 2006
@@ -1049,8 +1049,9 @@
   // fold (OP (zext x), (zext y)) -> (zext (OP x, y))
   // fold (OP (sext x), (sext y)) -> (sext (OP x, y))
   // fold (OP (aext x), (aext y)) -> (aext (OP x, y))
+  // fold (OP (trunc x), (trunc y)) -> (trunc (OP x, y))
   if ((N0.getOpcode() == ISD::ZERO_EXTEND || N0.getOpcode() == ISD::ANY_EXTEND||
-       N0.getOpcode() == ISD::SIGN_EXTEND) &&
+       N0.getOpcode() == ISD::SIGN_EXTEND || N0.getOpcode() == ISD::TRUNCATE) &&
       N0.getOperand(0).getValueType() == N1.getOperand(0).getValueType()) {
     SDOperand ORNode = DAG.getNode(N->getOpcode(), 
                                    N0.getOperand(0).getValueType(),
@@ -1059,19 +1060,6 @@
     return DAG.getNode(N0.getOpcode(), VT, ORNode);
   }
   
-  // fold (and (trunc x), (trunc y)) -> (trunc (and x, y))
-  // fold (or  (trunc x), (trunc y)) -> (trunc (or  x, y))
-  // fold (xor (trunc x), (trunc y)) -> (trunc (xor x, y))
-  if (N0.getOpcode() == ISD::TRUNCATE &&
-      N0.getOperand(0).getValueType() == N1.getOperand(0).getValueType()) {
-    SDOperand ORNode = DAG.getNode(N->getOpcode(),
-                                   N0.getOperand(0).getValueType(),
-                                   N0.getOperand(0), N1.getOperand(0));
-    AddToWorkList(ORNode.Val);
-    return DAG.getNode(ISD::TRUNCATE, VT, ORNode);
-  }
-  
-  
   // For each of OP in SHL/SRL/SRA/AND...
   //   fold (and (OP x, z), (OP y, z)) -> (OP (and x, y), z)
   //   fold (or  (OP x, z), (OP y, z)) -> (OP (or  x, y), z)






More information about the llvm-commits mailing list