diff options
author | Evan Cheng <evan.cheng@apple.com> | 2006-01-06 01:06:31 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2006-01-06 01:06:31 +0000 |
commit | b03f9b32d282c665c571d3fca88fad5eaf5393be (patch) | |
tree | a7ada5c4feb60a2b979769bc7cb3c8d617968f3f /llvm/lib/CodeGen | |
parent | b87030358d664daaa929542412c58074fdc2c8fb (diff) | |
download | bcm5719-llvm-b03f9b32d282c665c571d3fca88fad5eaf5393be.tar.gz bcm5719-llvm-b03f9b32d282c665c571d3fca88fad5eaf5393be.zip |
fold (shl x, 1) -> (add x, x)
llvm-svn: 25120
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 30a4c9f637c..9770ae232bf 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -1282,6 +1282,9 @@ SDOperand DAGCombiner::visitSHL(SDNode *N) { // fold (shl x, 0) -> x if (N1C && N1C->isNullValue()) return N0; + // fold (shl x, 1) -> (add x, x) + if (N1C && N1C->getValue() == 1) + return DAG.getNode(ISD::ADD, VT, N0, N0); // if (shl x, c) is known to be zero, return 0 if (N1C && MaskedValueIsZero(SDOperand(N, 0), ~0ULL >> (64-OpSizeInBits),TLI)) return DAG.getConstant(0, VT); |