diff options
author | Jim Laskey <jlaskey@mac.com> | 2006-09-25 19:32:58 +0000 |
---|---|---|
committer | Jim Laskey <jlaskey@mac.com> | 2006-09-25 19:32:58 +0000 |
commit | b5534e5c28a4c7f1b21c69f32bb39883379ef6da (patch) | |
tree | 3ba655e34536973a910f27fc851245e1b04ace38 /llvm/lib | |
parent | 437d9a3fb2965f0dc04a117b064ba5b61776595b (diff) | |
download | bcm5719-llvm-b5534e5c28a4c7f1b21c69f32bb39883379ef6da.tar.gz bcm5719-llvm-b5534e5c28a4c7f1b21c69f32bb39883379ef6da.zip |
Fix chain dropping in load and drop unused stores in ret blocks.
llvm-svn: 30600
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index c7823ffb9eb..e4fdedf6361 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -2650,13 +2650,13 @@ SDOperand DAGCombiner::visitLOAD(SDNode *N) { SDOperand ReplLoad = DAG.getLoad(N->getValueType(0), BetterChain, Ptr, SrcValue); - // Replace uses with token. - CombineTo(N, ReplLoad.getValue(0), ReplLoad.getValue(1)); - - // Old chain needs to be cleaned up. - AddToWorkList(Chain.Val); - - // Don't recombine on token. + // Create token factor to keep chain around. + SDOperand Token = DAG.getNode(ISD::TokenFactor, MVT::Other, + Chain, ReplLoad.getValue(1)); + + // Replace uses with load and token factor. + CombineTo(N, ReplLoad.getValue(0), Token); + return SDOperand(N, 0); } } @@ -2712,6 +2712,13 @@ SDOperand DAGCombiner::visitSTORE(SDNode *N) { } if (CombinerAA) { + // If the store ptr is a frame index and the frame index has a use of one + // and this is a return block, then the store is redundant. + if (Ptr.hasOneUse() && isa<FrameIndexSDNode>(Ptr) && + DAG.getRoot().getOpcode() == ISD::RET) { + return Chain; + } + // Walk up chain skipping non-aliasing memory nodes. SDOperand BetterChain = FindBetterChain(N, Chain); |