[LLVMdev] GVN incorrectly handling readnone parameter attribute?

Philip Reames listmail at philipreames.com
Wed May 21 17:31:08 PDT 2014


On 05/21/2014 02:52 PM, Robert Lougher wrote:
> On 21 May 2014 21:40, Robert Lougher <rob.lougher at gmail.com> wrote:
>> define i32* @get_pntr(i32* readnone %p) {
>> entry:
>>    ret i32* %p
>> }
>>
>> define void @store(i32* nocapture readnone %p) {
>> entry:
>>    store i32 10, i32* %p, align 4, !tbaa !1
>>    ret void
>> }
>>
> Further to my first post, based on the definition of readnone on an
> argument, this is also incorrect.  After get_pntr() has been inlined
> into store(), we are dereferencing %p, but it is still marked
> readnone.
>
> So we seem to have a couple of issues.  First GVN seems to be making
> incorrect assumptions based on argument attributes, and secondly
> inlining can invalidate existing attributes?
I'm not clear on the GVN issue, but looking at your example IR, the 
readnone attribute is definitely incorrect after inlining.

A question worth asking here: does this definition of readnone make 
sense?  I can see where it came from, but it seems to give very 
unintuitive reasoning here.

p.s. Is this with TOT or an earlier version?

Philip




More information about the llvm-dev mailing list