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.
patch (692 Bytes)
ISSUE: This code:
Crashes when run through opt -instcombine. InstCombiner visits
Fixed:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20020916/000286.html
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20020916/000287.html
Thanks for finding this! Dead bugs are the best kind. 
-Chris
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@Carter.net
ccarter@uiuc.edu
AIM: cartec69
-Chris
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/