[LLVMdev] Bug in InstructionCombining.cpp
Casey Carter
ccarter at cs.uiuc.edu
Tue Sep 17 10:03:00 PDT 2002
ISSUE: This code:
%bob = type { int }
int %alias() {
%pbob1 = alloca %bob
%pbob2 = getelementptr %bob* %pbob1 ;pbob2 aliases
pbob1
%pbobel = getelementptr %bob* %pbob2, long 0, ubyte 0
%rval = load int* %pbobel
ret int %rval
}
Crashes when run through opt -instcombine. InstCombiner visits
instructions in reverse declaration order, but
InstCombiner::visitGetElementPtr() , when trying to combine %pbobel with
%pbob2, assumes that aliases like %pbob2 have already been eliminated.
The result is a dereference of an invalid iterator, and an attempt to
replace %pbobel with "getelementptr %bob* %pbob1, ubyte 0".
ACTION: When combining constant index expressions in InstCombiner,
treat the source index as 0 if not present.
--
Casey Carter
Casey at Carter.net
ccarter at uiuc.edu
AIM: cartec69
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20020917/9f72978f/attachment.ksh>
More information about the llvm-dev
mailing list