diff options
author | David Majnemer <david.majnemer@gmail.com> | 2015-01-02 07:29:47 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2015-01-02 07:29:47 +0000 |
commit | c8a576b5c03de6bec83aa7dfe5f70adb5e0bafe9 (patch) | |
tree | a13f537fbf6ea3f7050cb63b66780c5e514ba196 /llvm/lib/Transforms | |
parent | 491331aca8389555070069699d92a9674c413b00 (diff) | |
download | bcm5719-llvm-c8a576b5c03de6bec83aa7dfe5f70adb5e0bafe9.tar.gz bcm5719-llvm-c8a576b5c03de6bec83aa7dfe5f70adb5e0bafe9.zip |
InstCombine: Detect when llvm.umul.with.overflow always overflows
We know overflow always occurs if both ~LHSKnownZero * ~RHSKnownZero
and LHSKnownOne * RHSKnownOne overflow.
llvm-svn: 225077
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index 34caf1a5ab9..20310b41689 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -443,6 +443,8 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { OverflowResult OR = computeOverflowForUnsignedMul(LHS, RHS, II); if (OR == OverflowResult::NeverOverflows) { return CreateOverflowTuple(II, Builder->CreateNUWMul(LHS, RHS), false); + } else if (OR == OverflowResult::AlwaysOverflows) { + return CreateOverflowTuple(II, Builder->CreateMul(LHS, RHS), true); } } // FALL THROUGH case Intrinsic::smul_with_overflow: |