[LLVMbugs] [Bug 18399] New: Thumb1: Folding SP Update incorrectly stop at modified pop

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jan 6 11:22:14 PST 2014


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

            Bug ID: 18399
           Summary: Thumb1: Folding SP Update incorrectly stop at modified
                    pop
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: ARM
          Assignee: unassignedbugs at nondot.org
          Reporter: zhaoshiz at codeaurora.org
                CC: llvmbugs at cs.uiuc.edu, t.p.northover at gmail.com
    Classification: Unclassified

In Thumb1, we check on whether registers are callee-saved when deciding to
pass by a pop instruction or not. But folding SP update adds caller-saved
registers to the pop, rendering the above mechanism invalid.

If tryFoldSPUpdateIntoPushPop() returns true, we can remember the modified pop
instruction. Later when moving past by callee-saved register restoration, we
can simply skip the remembered pop.

Tim, do you want me fix it or you have other plan?

$ cat test_case.ll

declare void @bar(i8*)

define void @test_varsize(...) minsize {
  %var = alloca i8, i32 8
  call void @bar(i8* %var)
  ret void
}

$ llc -mtriple=thumbv5-unkown-unkown -disable-fp-elim test_case.ll -o -
    .syntax unified
    .eabi_attribute    6, 3
    .eabi_attribute    8, 1
    .eabi_attribute    9, 1
    .eabi_attribute    20, 1
    .eabi_attribute    21, 1
    .eabi_attribute    23, 3
    .eabi_attribute    24, 1
    .eabi_attribute    25, 1
    .file    "test_case.ll"
    .text
    .globl    test_varsize
    .align    1
    .type    test_varsize,%function
    .code    16                      @ @test_varsize
    .thumb_func
test_varsize:
@ BB#0:
    sub    sp, #16
    push    {r5, r6, r7, lr}
    add    r7, sp, #8
    str    r3, [sp, #28]
    str    r2, [sp, #24]
    str    r1, [sp, #20]
    str    r0, [sp, #16]
    mov    r0, sp
    bl    bar
    pop    {r3}
    add    sp, #16
    bx    r3
    bx    lr
.Ltmp0:
    .size    test_varsize, .Ltmp0-test_varsize

-- 
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/20140106/9ac690fc/attachment.html>


More information about the llvm-bugs mailing list