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

Chris Lattner lattner at cs.uiuc.edu
Fri Mar 31 10:06:30 PST 2006



Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.133 -> 1.134
---
Log message:

Delete dead loads in the dag.  This allows us to compile 
vector.ll:test_extract_elt2 into:

_test_extract_elt2:
        lfd f1, 32(r3)
        blr

instead of:

_test_extract_elt2:
        lfd f0, 56(r3)
        lfd f0, 48(r3)
        lfd f0, 40(r3)
        lfd f1, 32(r3)
        lfd f0, 24(r3)
        lfd f0, 16(r3)
        lfd f0, 8(r3)
        lfd f0, 0(r3)
        blr



---
Diffs of the changes:  (+5 -0)

 DAGCombiner.cpp |    5 +++++
 1 files changed, 5 insertions(+)


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.133 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.134
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.133	Tue Mar 28 16:19:47 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp	Fri Mar 31 12:06:18 2006
@@ -2261,6 +2261,11 @@
   SDOperand Chain    = N->getOperand(0);
   SDOperand Ptr      = N->getOperand(1);
   SDOperand SrcValue = N->getOperand(2);
+
+  // If there are no uses of the loaded value, change uses of the chain value
+  // into uses of the chain input (i.e. delete the dead load).
+  if (N->hasNUsesOfValue(0, 0))
+    return CombineTo(N, DAG.getNode(ISD::UNDEF, N->getValueType(0)), Chain);
   
   // If this load is directly stored, replace the load value with the stored
   // value.






More information about the llvm-commits mailing list