<html>
    <head>
      <base href="https://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 --- - [IPRA] Failed to mark return address register as clobbered"
   href="https://llvm.org/bugs/show_bug.cgi?id=28569">28569</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[IPRA] Failed to mark return address register as clobbered
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Register Allocator
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>zyfwong@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>=== ipra-call.c ===
__attribute__((noinline))
int foo2(int b)
{
    return b + 2;
}

__attribute__((noinline))
int bar2(int b)
{
    return b + foo2(b);
}

$ clang -target arm -Oz -emit-llvm -S ipra-call.c -o ipra-call.ll
$ llc -march=arm ipra-call.ll -enable-ipra=true -print-regusage

bar2 Clobbered Registers: SP R0 R1 R2 R3 R12 R12_SP R0_R1 R2_R3 
foo2 Clobbered Registers: R0 R1 R0_R1 

===== ipra-call.s =====
foo2:                                   @ @foo2
    add    r0, r0, #2
    mov    pc, lr

bar2:                                   @ @bar2
    push    {r11, lr}
    mov    r11, sp
    mov    r2, r0
    bl    foo2
    add    r0, r0, r2
    pop    {r11, lr}
    mov    pc, lr


I think bar2 should mark LR as Clobbered.
Current implementation thinks that a `call foo' instruction only clobbers
registers that clobbers by function `foo', but it's not true: `call foo' will
clobbers both registers clobbers by function `foo' and other physical registers
, in this case, LR.</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>