From daa24b978986f8a31c3bfdf47cc3556caac0917d Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Sat, 5 Sep 2015 20:44:56 +0000 Subject: [InstCombine] Don't assume m_Mul gives back an Instruction This fixes PR24713. llvm-svn: 246933 --- llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Transforms') diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index 6e4336ef875..b3366bb9888 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -2246,7 +2246,9 @@ static Instruction *ProcessUMulZExtIdiom(ICmpInst &I, Value *MulVal, assert(I.getOperand(0) == MulVal || I.getOperand(1) == MulVal); assert(I.getOperand(0) == OtherVal || I.getOperand(1) == OtherVal); - Instruction *MulInstr = cast(MulVal); + auto *MulInstr = dyn_cast(MulVal); + if (!MulInstr) + return nullptr; assert(MulInstr->getOpcode() == Instruction::Mul); auto *LHS = cast(MulInstr->getOperand(0)), -- cgit v1.2.3