diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2019-04-16 20:31:41 +0000 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-04-16 20:31:41 +0000 |
| commit | 52b24ee932aabdea16b603f405359f5270dfd38b (patch) | |
| tree | 5cfd632542ded69c2e5aefd79dbae9877dfe8d46 /llvm/lib | |
| parent | 765f0183815556be357429dbc3421fcb00e0e920 (diff) | |
| download | bcm5719-llvm-52b24ee932aabdea16b603f405359f5270dfd38b.tar.gz bcm5719-llvm-52b24ee932aabdea16b603f405359f5270dfd38b.zip | |
[CVP] Simplify umulo and smulo that cannot overflow
If a umul.with.overflow or smul.with.overflow operation cannot
overflow, simplify it to a simple mul nuw / mul nsw. After the
refactoring in D60668 this is just a matter of removing an
explicit check against multiplications.
Differential Revision: https://reviews.llvm.org/D60791
llvm-svn: 358521
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp index bc4daf1c9c1..b650971624a 100644 --- a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp +++ b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp @@ -400,15 +400,10 @@ static bool processSwitch(SwitchInst *SI, LazyValueInfo *LVI, // See if we can prove that the given overflow intrinsic will not overflow. static bool willNotOverflow(WithOverflowInst *WO, LazyValueInfo *LVI) { - // TODO: Also support multiplication. - Instruction::BinaryOps BinOp = WO->getBinaryOp(); - if (BinOp == Instruction::Mul) - return false; - Value *RHS = WO->getRHS(); ConstantRange RRange = LVI->getConstantRange(RHS, WO->getParent(), WO); ConstantRange NWRegion = ConstantRange::makeGuaranteedNoWrapRegion( - BinOp, RRange, WO->getNoWrapKind()); + WO->getBinaryOp(), RRange, WO->getNoWrapKind()); // As an optimization, do not compute LRange if we do not need it. if (NWRegion.isEmptySet()) return false; |

