[llvm-commits] [llvm] r162098 - in /llvm/trunk: lib/Analysis/MemoryBuiltins.cpp test/Transforms/InstCombine/objsize.ll
Benjamin Kramer
benny.kra at gmail.com
Fri Aug 17 12:29:04 PDT 2012
On 17.08.2012, at 20:12, Eli Friedman <eli.friedman at gmail.com> wrote:
> On Fri, Aug 17, 2012 at 11:07 AM, Benjamin Kramer <benny.kra at gmail.com> wrote:
>>
>> On 17.08.2012, at 19:47, Eli Friedman <eli.friedman at gmail.com> wrote:
>>
>>> On Fri, Aug 17, 2012 at 7:16 AM, Benjamin Kramer
>>> <benny.kra at googlemail.com> wrote:
>>>> Author: d0k
>>>> Date: Fri Aug 17 09:16:37 2012
>>>> New Revision: 162098
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=162098&view=rev
>>>> Log:
>>>> Guard MemoryBuiltins against self-looping GEPs, which can occur in unreachable code due to constant propagation.
>>>>
>>>> Fixes PR13621.
>>>>
>>>> Modified:
>>>> llvm/trunk/lib/Analysis/MemoryBuiltins.cpp
>>>> llvm/trunk/test/Transforms/InstCombine/objsize.ll
>>>>
>>>> Modified: llvm/trunk/lib/Analysis/MemoryBuiltins.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryBuiltins.cpp?rev=162098&r1=162097&r2=162098&view=diff
>>>> ==============================================================================
>>>> --- llvm/trunk/lib/Analysis/MemoryBuiltins.cpp (original)
>>>> +++ llvm/trunk/lib/Analysis/MemoryBuiltins.cpp Fri Aug 17 09:16:37 2012
>>>> @@ -473,6 +473,10 @@
>>>> }
>>>>
>>>> SizeOffsetType ObjectSizeOffsetVisitor::visitGEPOperator(GEPOperator &GEP) {
>>>> + // Ignore self-referencing GEPs, they can occur in unreachable code.
>>>> + if (&GEP == GEP.getPointerOperand())
>>>> + return unknown();
>>>
>>> What happens when you have two GEPs referencing each other?
>>
>> I've wondered about this too, but can it really happen?
>
> I don't see why not: dominance rules are completely ignored in unreachable code.
>
>> I'm also not sure how to integrate a visited set into the instvisitor.
>
> Just add a member, no?
Yup, that seems to work because there is a single point in the visitor that is always called (compute()). Fixed in r162120.
- Ben
More information about the llvm-commits
mailing list