summaryrefslogtreecommitdiff
path: root/lib/Transforms/InstCombine
diff options
context:
space:
mode:
authorJoey Gouly <joey.gouly@arm.com>2013-09-30 14:18:35 +0000
committerJoey Gouly <joey.gouly@arm.com>2013-09-30 14:18:35 +0000
commit6ef4dd8cb6852fd0036244a07dc944dc8fb8933c (patch)
tree81c4f94db7ceb0a0209ec27b7543e813b1b74af5 /lib/Transforms/InstCombine
parent6206a132a76d407fd276de17147d8c9c2c9e9e9d (diff)
downloadllvm-6ef4dd8cb6852fd0036244a07dc944dc8fb8933c.tar.gz
llvm-6ef4dd8cb6852fd0036244a07dc944dc8fb8933c.tar.bz2
llvm-6ef4dd8cb6852fd0036244a07dc944dc8fb8933c.tar.xz
Fix a bug in InstCombine where it attempted to cast a Value* to an Instruction*
when it was actually a Constant*. There are quite a few other casts to Instruction that might have the same problem, but this is the only one I have a test case for. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191668 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine')
-rw-r--r--lib/Transforms/InstCombine/InstCombineMulDivRem.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
index 9c310f04dc..5c5ee1256f 100644
--- a/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
+++ b/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
@@ -519,10 +519,10 @@ Instruction *InstCombiner::visitFMul(BinaryOperator &I) {
if (Opnd0->hasOneUse()) {
// -X * Y => -(X*Y) (Promote negation as high as possible)
Value *T = Builder->CreateFMul(N0, Opnd1);
- cast<Instruction>(T)->setDebugLoc(I.getDebugLoc());
Instruction *Neg = BinaryOperator::CreateFNeg(T);
if (I.getFastMathFlags().any()) {
- cast<Instruction>(T)->copyFastMathFlags(&I);
+ if (Instruction *TI = dyn_cast<Instruction>(T))
+ TI->copyFastMathFlags(&I);
Neg->copyFastMathFlags(&I);
}
return Neg;