diff options
author | Evan Cheng <evan.cheng@apple.com> | 2007-03-23 20:55:21 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2007-03-23 20:55:21 +0000 |
commit | e2f5f24e8e47081562b0e3caef2ee9a89f6ac42d (patch) | |
tree | ea69c7e269a4d294217c8784786d837b1ccd4250 /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
parent | ea8b07ee6badc731c52a0e1668c7a8eacf9a3b1d (diff) | |
download | bcm5719-llvm-e2f5f24e8e47081562b0e3caef2ee9a89f6ac42d.tar.gz bcm5719-llvm-e2f5f24e8e47081562b0e3caef2ee9a89f6ac42d.zip |
Also replace uses of SRL if that's also folded during ReduceLoadWidth().
llvm-svn: 35286
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 1aea2ed35f5..df951a51bb2 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -2279,6 +2279,7 @@ SDOperand DAGCombiner::ReduceLoadWidth(SDNode *N) { 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 @@ SDOperand DAGCombiner::ReduceLoadWidth(SDNode *N) { if (MVT::getSizeInBits(N0.getValueType()) <= EVTBits) return SDOperand(); ShAmt /= 8; + CombineSRL = true; } } } @@ -2317,7 +2319,12 @@ SDOperand DAGCombiner::ReduceLoadWidth(SDNode *N) { : 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! |