http://llvm.org/bugs/show_bug.cgi?id=15313

            Bug ID: 15313
           Summary: Argument addAttr adds to the wrong Argument
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Created attachment 10047
  --> http://llvm.org/bugs/attachment.cgi?id=10047&action=edit
The IR Module

Given the following LLVM IR:

define void @t1(i32* nocapture %a) {
  ret void
}

declare void @t1.a(i32 %c, i32)* %a)

F = @t1
F2 = @t1.a

I = Argument[0] of @t1
I2 = Argument[1] of @t1.a

if I then do:

  I2->addAttr(F->getAttributes()
                .getParamAttributes(I->getArgNo() + 1));

Instead of I2 getting the attribute, Argument[0] gets it, and it ends up as:

declare void @t1.a(i32 nocapture %c, i32* %a)

when it should be:

declare void @t1.a(i32 %c, i32* nocapture %a)


F->getAttributes().dump()
  PAL[
    { 1 => nocapture }
  ]

F2->getAttributes().dump()
  PAL[
    { 1 => nocapture }
  ]

I'm guessing this second dump should be "2 => nocapture".

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to