diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2011-04-29 08:15:41 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2011-04-29 08:15:41 +0000 |
commit | c2e31c1461f96e3d8325e58ef396a865adf7b302 (patch) | |
tree | 30c2abefa11634eb5e55c0d9fe621c43e3f9099c /lib/Transforms | |
parent | bb0fff0cb433eaabfad88d934be02097bd62ccda (diff) | |
download | external_llvm-c2e31c1461f96e3d8325e58ef396a865adf7b302.zip external_llvm-c2e31c1461f96e3d8325e58ef396a865adf7b302.tar.gz external_llvm-c2e31c1461f96e3d8325e58ef396a865adf7b302.tar.bz2 |
InstCombine: turn (C1 << A) << C2) into (C1 << C2) << A)
Fixes PR9809.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130485 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineShifts.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineShifts.cpp b/lib/Transforms/InstCombine/InstCombineShifts.cpp index a7f8005..8143b25 100644 --- a/lib/Transforms/InstCombine/InstCombineShifts.cpp +++ b/lib/Transforms/InstCombine/InstCombineShifts.cpp @@ -644,7 +644,14 @@ Instruction *InstCombiner::visitShl(BinaryOperator &I) { return &I; } } - + + // (C1 << A) << C2) -> (C1 << C2) << A) + Constant *C1, *C2; + Value *A; + if (match(I.getOperand(0), m_OneUse(m_Shl(m_Constant(C1), m_Value(A)))) && + match(I.getOperand(1), m_Constant(C2))) + return BinaryOperator::CreateShl(ConstantExpr::getShl(C1, C2), A); + return 0; } |