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>
> ISSUE: This code: > Crashes when run through opt -instcombine. InstCombiner visitsFixed: 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 at Carter.net > ccarter at uiuc.edu > AIM: cartec69 > >-Chris http://llvm.cs.uiuc.edu/ http://www.nondot.org/~sabre/Projects/
Maybe Matching Threads
- [LLVMdev] InstructionCombining.cpp inconsistency in whether it modifies the CFG?
- [LLVMdev] InstructionCombining.cpp inconsistency in whether it modifies the CFG?
- [LLVMdev] Linux-x86 Compatability
- [LLVMdev] new warning in InstructionCombining.cpp
- [LLVMdev] InstructionCombining forgets alignment of globals