aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-03-05 19:53:55 +0000
committerChris Lattner <sabre@nondot.org>2006-03-05 19:53:55 +0000
commitcac7059d0f8e6e1be5d4001eb942e23780af2300 (patch)
tree769cf1410fdc9163929357b70d948431758f3b54
parentc1d9f1de41b26769752224829987a6aa06fe4b87 (diff)
downloadexternal_llvm-cac7059d0f8e6e1be5d4001eb942e23780af2300.zip
external_llvm-cac7059d0f8e6e1be5d4001eb942e23780af2300.tar.gz
external_llvm-cac7059d0f8e6e1be5d4001eb942e23780af2300.tar.bz2
Reinstate this now that the offending opposite xform has been removed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26548 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/SelectionDAG/DAGCombiner.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index bf4b39d..1e05d58 100644
--- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -1454,6 +1454,13 @@ SDOperand DAGCombiner::visitSHL(SDNode *N) {
if (N1C && N0.getOpcode() == ISD::SRA && N1 == N0.getOperand(1))
return DAG.getNode(ISD::AND, VT, N0.getOperand(0),
DAG.getConstant(~0ULL << N1C->getValue(), VT));
+ // fold (shl (add x, c1), c2) -> (add (shl x, c2), c1<<c2)
+ if (N1C && N0.getOpcode() == ISD::ADD && N0.Val->hasOneUse() &&
+ isa<ConstantSDNode>(N0.getOperand(1))) {
+ return DAG.getNode(ISD::ADD, VT,
+ DAG.getNode(ISD::SHL, VT, N0.getOperand(0), N1),
+ DAG.getNode(ISD::SHL, VT, N0.getOperand(1), N1));
+ }
return SDOperand();
}