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

Evan Cheng evan.cheng at apple.com
Fri Mar 23 13:55:38 PDT 2007



Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.278 -> 1.279
---
Log message:

Also replace uses of SRL if that's also folded during ReduceLoadWidth().

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

 DAGCombiner.cpp |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletion(-)


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.278 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.279
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.278	Thu Mar 22 21:16:52 2007
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp	Fri Mar 23 15:55:21 2007
@@ -2279,6 +2279,7 @@
 
   unsigned EVTBits = MVT::getSizeInBits(EVT);
   unsigned ShAmt = 0;
+  bool CombineSRL =  false;
   if (N0.getOpcode() == ISD::SRL && N0.hasOneUse()) {
     if (ConstantSDNode *N01 = dyn_cast<ConstantSDNode>(N0.getOperand(1))) {
       ShAmt = N01->getValue();
@@ -2288,6 +2289,7 @@
         if (MVT::getSizeInBits(N0.getValueType()) <= EVTBits)
           return SDOperand();
         ShAmt /= 8;
+        CombineSRL = true;
       }
     }
   }
@@ -2317,7 +2319,12 @@
       : DAG.getExtLoad(ExtType, VT, LN0->getChain(), NewPtr,
                        LN0->getSrcValue(), LN0->getSrcValueOffset(), EVT);
     AddToWorkList(N);
-    CombineTo(N0.Val, Load, Load.getValue(1));
+    if (CombineSRL) {
+      std::vector<SDNode*> NowDead;
+      DAG.ReplaceAllUsesOfValueWith(N0.getValue(1), Load.getValue(1), NowDead);
+      CombineTo(N->getOperand(0).Val, Load);
+    } else
+      CombineTo(N0.Val, Load, Load.getValue(1));
     if (ShAmt)
       return DAG.getNode(N->getOpcode(), VT, Load);
     return SDOperand(N, 0);   // Return N so it doesn't get rechecked!






More information about the llvm-commits mailing list