diff options
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineShifts.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineShifts.cpp b/lib/Transforms/InstCombine/InstCombineShifts.cpp index 8cf76e5e8a..f9e94f225f 100644 --- a/lib/Transforms/InstCombine/InstCombineShifts.cpp +++ b/lib/Transforms/InstCombine/InstCombineShifts.cpp @@ -709,6 +709,12 @@ Instruction *InstCombiner::visitShl(BinaryOperator &I) { match(I.getOperand(1), m_Constant(C2))) return BinaryOperator::CreateShl(ConstantExpr::getShl(C1, C2), A); + // shl (c1 , add(y , c2)) -> (shl (shl(c1, c2)), y) + if (match(I.getOperand(0), m_Constant(C1)) && + match(I.getOperand(1), m_Add(m_Value(A), m_Constant(C2)))) { + return BinaryOperator::CreateShl(ConstantExpr::getShl(C1, C2), A); + } + return 0; } |