diff options
| author | Philip Reames <listmail@philipreames.com> | 2017-12-27 01:30:12 +0000 |
|---|---|---|
| committer | Philip Reames <listmail@philipreames.com> | 2017-12-27 01:30:12 +0000 |
| commit | cd13a663813f74a2d464387ad75072ec5b696644 (patch) | |
| tree | 5c725d816d3072a1ab5dadf64ea9fb3c9662b6b7 /llvm/lib | |
| parent | 5000ba69d740c765a537c0a8d2e7990ff4f4f47c (diff) | |
| download | bcm5719-llvm-cd13a663813f74a2d464387ad75072ec5b696644.tar.gz bcm5719-llvm-cd13a663813f74a2d464387ad75072ec5b696644.zip | |
[instcombine] add powi(x, 2) -> x * x
llvm-svn: 321468
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index 4dfb22abb6e..5e0778d9ae2 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -1934,6 +1934,10 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { if (Power->isMinusOne()) return BinaryOperator::CreateFDiv(ConstantFP::get(CI.getType(), 1.0), II->getArgOperand(0)); + // powi(x, 2) -> x*x + if (Power->equalsInt(2)) + return BinaryOperator::CreateFMul(II->getArgOperand(0), + II->getArgOperand(0)); } break; |

