<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Argument addAttr adds to the wrong Argument"
   href="http://llvm.org/bugs/show_bug.cgi?id=15313">15313</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Argument addAttr adds to the wrong Argument
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>joel.gouly@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=10047" name="attach_10047" title="The IR Module">attachment 10047</a> <a href="attachment.cgi?id=10047&action=edit" title="The IR Module">[details]</a></span>
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".</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>