llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Function replaceCongruentIVs can crash if incoming phi value is a global variable

Open mveriksson opened this issue 10 years ago • 0 comments

Bugzilla Link 26574
Version trunk
OS Linux
Attachments Reduced input file with crash in indvars

Extended Description

I found this crash in one of our internal test suites and reduced it to the attached repr.ll.

opt -S -indvars repr.ll

crashes like this:

opt: ../include/llvm/Support/Casting.h:237: typename cast_retty<X, Y *>::ret_type llvm::cast(Y *) [X = llvm::Instruction, Y = llvm::Value]: Assertion `isa(Val) && "cast() argument of incompatible type!"' failed.

Called from this line in ScalarEvolutionExpander.cpp: Instruction *OrigInc = cast(OrigPhiRef->getIncomingValueForBlock(LatchBlock));

(gdb) p OrigPhiRef->dump() %_tmp19 = phi i16** [ @​pglob, %bb_lslct36 ], [ %_tmp196, %bb2 ]

pglob is a "external global i16*" here.

mveriksson avatar Feb 11 '16 14:02 mveriksson