summaryrefslogtreecommitdiffstats
path: root/llvm/lib
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
commitd51a35c6a03f50160cd9320cf7b81f7e36e56441 (patch)
tree5e67277371dbda09d0f1878410447a6f0b0a5925 /llvm/lib
parent59d93af4a55897b99873225249692cc7d8fe5969 (diff)
downloadbcm5719-llvm-d51a35c6a03f50160cd9320cf7b81f7e36e56441.tar.gz
bcm5719-llvm-d51a35c6a03f50160cd9320cf7b81f7e36e56441.zip
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. llvm-svn: 191668
Diffstat (limited to 'llvm/lib')
-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 9c310f04dcd..5c5ee1256f3 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud