[llvm-bugs] [Bug 24588] New: aarch64 backend uses x18 on ios

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 26 10:34:47 PDT 2015


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

            Bug ID: 24588
           Summary: aarch64 backend uses x18 on ios
           Product: new-bugs
           Version: trunk
          Hardware: Macintosh
                OS: other
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: andrew.b.adams at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 14780
  --> https://llvm.org/bugs/attachment.cgi?id=14780&action=edit
A chunk of ll large enough to demonstrate the issue

This is a minor complaint, but it produces a very hard-to-debug error.

If you compile some .ll with a target triple aarch64-ios, then the aarch64
backend will happily use x18, even though that's reserved by the system on this
platform.

This causes crashes due to register-stomping. Clang avoids this by setting the
additional flag -mattr=+reserve-x18, but having IOS in the target triple seems
like it should be enough.

To reproduce, compile the attached .ll like so:

llc -mtriple aarch64-ios initmod.opengl_64.ll -filetype=asm -o - | grep x18
    orr    w0, wzr, #0x18
    orr    w0, wzr, #0x18
    ldrsw    x18, [x22, #40]
    lsl    x18, x18, #1
    add     x5, x5, x18
    ldrsw    x18, [x22, #40]
    lsl    x18, x18, #2
    add     x5, x5, x18
    ldrsw    x18, [x21, #40]
    lsl    x18, x18, #1
    add     x3, x3, x18
    ldrsw    x18, [x21, #40]
    lsl    x18, x18, #2
    add     x3, x3, x18
    sxtw    x18, w18
    str    w3, [x1, x18, lsl #2]

If you add -mattr=+reserve-x18, it does the right thing.

There's nothing very special about the attached ll - any sufficiently large
piece of ll should reproduce this.

-- 
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/20150826/5d7fb3ce/attachment.html>


More information about the llvm-bugs mailing list