aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-01-04 07:36:02 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-01-04 07:36:02 +0000
commit087dc8b83197db9e0f87885da20feea574343c3f (patch)
tree454da0ce168c6ec5b8523bbfac026f316c776042 /llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
parent6ee8d17bc61d6a7e479b349d7f48edeabe61791f (diff)
downloadllvm-087dc8b83197db9e0f87885da20feea574343c3f.zip
llvm-087dc8b83197db9e0f87885da20feea574343c3f.tar.gz
llvm-087dc8b83197db9e0f87885da20feea574343c3f.tar.bz2
InstCombine: match can find ConstantExprs, don't assume we have a Value
We assumed the output of a match was a Value, this would cause us to assert because we would fail a cast<>. Instead, use a helper in the Operator family to hide the distinction between Value and Constant. This fixes PR22087. llvm-svn: 225127
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
index 255e587..165a9e9 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
@@ -341,10 +341,10 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) {
bool ShlNSW = false;
if (match(Op0, m_Shl(m_One(), m_Value(Y)))) {
BO = BinaryOperator::CreateShl(Op1, Y);
- ShlNSW = cast<BinaryOperator>(Op0)->hasNoSignedWrap();
+ ShlNSW = cast<ShlOperator>(Op0)->hasNoSignedWrap();
} else if (match(Op1, m_Shl(m_One(), m_Value(Y)))) {
BO = BinaryOperator::CreateShl(Op0, Y);
- ShlNSW = cast<BinaryOperator>(Op1)->hasNoSignedWrap();
+ ShlNSW = cast<ShlOperator>(Op1)->hasNoSignedWrap();
}
if (BO) {
if (I.hasNoUnsignedWrap())