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

Chris Lattner sabre at nondot.org
Mon Nov 27 13:50:16 PST 2006



Changes in directory llvm/lib/CodeGen/SelectionDAG:

TargetLowering.cpp updated: 1.80 -> 1.81
---
Log message:

Fix the dag combiner bug corresponding to PR1014: http://llvm.org/PR1014 .


---
Diffs of the changes:  (+8 -8)

 TargetLowering.cpp |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.80 llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.81
--- llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.80	Thu Nov  9 12:56:43 2006
+++ llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp	Mon Nov 27 15:50:02 2006
@@ -363,20 +363,20 @@
       return TLO.CombineTo(Op, Op.getOperand(0));
     if ((DemandedMask & KnownZero2) == DemandedMask)
       return TLO.CombineTo(Op, Op.getOperand(1));
+      
+    // If all of the unknown bits are known to be zero on one side or the other
+    // (but not both) turn this into an *inclusive* or.
+    //    e.g. (A & C1)^(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0
+    if ((DemandedMask & ~KnownZero & ~KnownZero2) == 0)
+      return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::OR, Op.getValueType(),
+                                               Op.getOperand(0),
+                                               Op.getOperand(1)));
     
     // Output known-0 bits are known if clear or set in both the LHS & RHS.
     KnownZeroOut = (KnownZero & KnownZero2) | (KnownOne & KnownOne2);
     // Output known-1 are known to be set if set in only one of the LHS, RHS.
     KnownOneOut = (KnownZero & KnownOne2) | (KnownOne & KnownZero2);
     
-    // If all of the unknown bits are known to be zero on one side or the other
-    // (but not both) turn this into an *inclusive* or.
-    //    e.g. (A & C1)^(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0
-    if (uint64_t UnknownBits = DemandedMask & ~(KnownZeroOut|KnownOneOut))
-      if ((UnknownBits & (KnownZero|KnownZero2)) == UnknownBits)
-        return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::OR, Op.getValueType(),
-                                                 Op.getOperand(0),
-                                                 Op.getOperand(1)));
     // If all of the demanded bits on one side are known, and all of the set
     // bits on that side are also known to be set on the other side, turn this
     // into an AND, as we know the bits will be cleared.






More information about the llvm-commits mailing list