diff options
author | Jim Laskey <jlaskey@mac.com> | 2006-10-14 12:14:27 +0000 |
---|---|---|
committer | Jim Laskey <jlaskey@mac.com> | 2006-10-14 12:14:27 +0000 |
commit | d4edf2cf911f1f6543ec6cc89fe7b8bb37ad95b3 (patch) | |
tree | 6e8372cd67f3abca8476c8c743b8875375f4eda8 /lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
parent | f6774c7ec1033cbae10a950aa292d46dac48770e (diff) |
Tidy up after truncstore changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30961 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 55 |
1 files changed, 9 insertions, 46 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 2ee98f0654..1cac34d8d8 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -2743,50 +2743,6 @@ SDOperand DAGCombiner::visitSTORE(SDNode *N) { SDOperand Value = ST->getValue(); SDOperand Ptr = ST->getBasePtr(); - // FIXME - Switch over after StoreSDNode comes online. - if (ST->isTruncatingStore()) { - if (CombinerAA) { - // Walk up chain skipping non-aliasing memory nodes. - SDOperand BetterChain = FindBetterChain(N, Chain); - - // If there is a better chain. - if (Chain != BetterChain) { - // Replace the chain to avoid dependency. - SDOperand ReplTStore = - DAG.getTruncStore(BetterChain, Value, Ptr, ST->getSrcValue(), - ST->getSrcValueOffset(), ST->getStoredVT()); - - // Create token to keep both nodes around. - SDOperand Token = - DAG.getNode(ISD::TokenFactor, MVT::Other, Chain, ReplTStore); - - // Don't add users to work list. - return CombineTo(N, Token, false); - } - } - - return SDOperand(); - } - - // If this is a store that kills a previous store, remove the previous store. - if (ISD::isNON_TRUNCStore(Chain.Val)) { - StoreSDNode *PrevST = cast<StoreSDNode>(Chain); - if (PrevST->getBasePtr() == Ptr && - Chain.Val->hasOneUse() /* Avoid introducing DAG cycles */ && - // Make sure that these stores are the same value type: - // FIXME: we really care that the second store is >= size of the first. - Value.getValueType() == PrevST->getValue().getValueType()) { - // Create a new store of Value that replaces both stores. - if (PrevST->getValue() == Value) // Same value multiply stored. - return Chain; - SDOperand NewStore = DAG.getStore(PrevST->getChain(), Value, Ptr, - ST->getSrcValue(), ST->getSrcValueOffset()); - CombineTo(N, NewStore); // Nuke this store. - CombineTo(Chain.Val, NewStore); // Nuke the previous store. - return SDOperand(N, 0); - } - } - // If this is a store of a bit convert, store the input value. // FIXME: This needs to know that the resultant store does not need a // higher alignment than the original. @@ -2809,8 +2765,15 @@ SDOperand DAGCombiner::visitSTORE(SDNode *N) { // If there is a better chain. if (Chain != BetterChain) { // Replace the chain to avoid dependency. - SDOperand ReplStore = DAG.getStore(BetterChain, Value, Ptr, - ST->getSrcValue(), ST->getSrcValueOffset()); + SDOperand ReplStore; + if (ST->isTruncatingStore()) { + ReplStore = DAG.getTruncStore(BetterChain, Value, Ptr, + ST->getSrcValue(),ST->getSrcValueOffset(), ST->getStoredVT()); + } else { + ReplStore = DAG.getStore(BetterChain, Value, Ptr, + ST->getSrcValue(), ST->getSrcValueOffset()); + } + // Create token to keep both nodes around. SDOperand Token = DAG.getNode(ISD::TokenFactor, MVT::Other, Chain, ReplStore); |