[llvm-bugs] [Bug 28569] New: [IPRA] Failed to mark return address register as clobbered

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 14 23:54:15 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28569

            Bug ID: 28569
           Summary: [IPRA] Failed to mark return address register as
                    clobbered
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Register Allocator
          Assignee: unassignedbugs at nondot.org
          Reporter: zyfwong at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

=== 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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160715/b5f14431/attachment.html>


More information about the llvm-bugs mailing list