summaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-02-29 13:27:00 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-02-29 13:27:00 +0000
commitf1820b54e4d08ed78ca76b80b8bebb91cdc798a5 (patch)
treef6d49ef8ef1122df14c7053aa77ff9c908dd5d71 /lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
parent2b4f4910458f9bfd15315444ed47b4f41473a93d (diff)
downloadllvm-f1820b54e4d08ed78ca76b80b8bebb91cdc798a5.tar.gz
llvm-f1820b54e4d08ed78ca76b80b8bebb91cdc798a5.tar.bz2
llvm-f1820b54e4d08ed78ca76b80b8bebb91cdc798a5.tar.xz
LegalizeIntegerTypes: Reorder operations in the "big shift by small amount" optimization, making the lives of later passes easier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151722 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
index cdc5d5c4b6..41506d17b7 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
@@ -1419,10 +1419,10 @@ ExpandShiftWithKnownAmountBit(SDNode *N, SDValue &Lo, SDValue &Hi) {
std::swap(InL, InH);
// Use a little trick to get the bits that move from Lo to Hi. First
- // calculate the shift with amount-1.
- SDValue Sh1 = DAG.getNode(Op2, dl, NVT, InL, Amt2);
- // Then shift one bit further to get the right result.
- SDValue Sh2 = DAG.getNode(Op2, dl, NVT, Sh1, DAG.getConstant(1, ShTy));
+ // shift by one bit.
+ SDValue Sh1 = DAG.getNode(Op2, dl, NVT, InL, DAG.getConstant(1, ShTy));
+ // Then compute the remaining shift with amount-1.
+ SDValue Sh2 = DAG.getNode(Op2, dl, NVT, Sh1, Amt2);
Lo = DAG.getNode(N->getOpcode(), dl, NVT, InL, Amt);
Hi = DAG.getNode(ISD::OR, dl, NVT, DAG.getNode(Op1, dl, NVT, InH, Amt),Sh2);