From 6ef4dd8cb6852fd0036244a07dc944dc8fb8933c Mon Sep 17 00:00:00 2001 From: Joey Gouly Date: Mon, 30 Sep 2013 14:18:35 +0000 Subject: 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 --- lib/Transforms/InstCombine/InstCombineMulDivRem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/Transforms/InstCombine') 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(T)->setDebugLoc(I.getDebugLoc()); Instruction *Neg = BinaryOperator::CreateFNeg(T); if (I.getFastMathFlags().any()) { - cast(T)->copyFastMathFlags(&I); + if (Instruction *TI = dyn_cast(T)) + TI->copyFastMathFlags(&I); Neg->copyFastMathFlags(&I); } return Neg; -- cgit v1.2.3