summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-03-31 18:06:18 +0000
committerChris Lattner <sabre@nondot.org>2006-03-31 18:06:18 +0000
commit2d8551c85bb7a3be70b366a5f25d9b364c30fc7e (patch)
treece124c54ed9d83f34d6d8da2b2fc873a0de4795f /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
parenta2834fa9671529d98b7a8b32601623a32c175283 (diff)
downloadbcm5719-llvm-2d8551c85bb7a3be70b366a5f25d9b364c30fc7e.tar.gz
bcm5719-llvm-2d8551c85bb7a3be70b366a5f25d9b364c30fc7e.zip
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 llvm-svn: 27296
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index a559d3e469e..4d1e39359ba 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -2261,6 +2261,11 @@ SDOperand DAGCombiner::visitLOAD(SDNode *N) {
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.
OpenPOWER on IntegriCloud