diff options
author | Duncan Sands <baldrick@free.fr> | 2010-12-22 13:36:08 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2010-12-22 13:36:08 +0000 |
commit | 37bf92b5238434b00fde79347ba5336e7554e562 (patch) | |
tree | e0594f4d7ad0969d3807ec13dc85a8b50e0381f8 /lib/Transforms/InstCombine/InstCombineMulDivRem.cpp | |
parent | fc7072c3c4db03555a0a62220d61a2b85acd01fd (diff) |
Add a generic expansion transform: A op (B op' C) -> (A op B) op' (A op C)
if both A op B and A op C simplify. This fires fairly often but doesn't
make that much difference. On gcc-as-one-file it removes two "and"s and
turns one branch into a select.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122399 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombineMulDivRem.cpp')
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineMulDivRem.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp index a2fe0cf659..40b9cfd687 100644 --- a/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp +++ b/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp @@ -54,6 +54,9 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) { if (Value *V = SimplifyMulInst(Op0, Op1, TD)) return ReplaceInstUsesWith(I, V); + if (Value *V = SimplifyUsingDistributiveLaws(I)) + return ReplaceInstUsesWith(I, V); + // Simplify mul instructions with a constant RHS. if (Constant *Op1C = dyn_cast<Constant>(Op1)) { if (ConstantInt *CI = dyn_cast<ConstantInt>(Op1C)) { |