[LLVMbugs] [Bug 22015] New: post-RA scheduler breaks unwinding through indirect calls

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Dec 23 05:50:01 PST 2014


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

            Bug ID: 22015
           Summary: post-RA scheduler breaks unwinding through indirect
                    calls
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: PowerPC
          Assignee: unassignedbugs at nondot.org
          Reporter: jay.foad at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 13588
  --> http://llvm.org/bugs/attachment.cgi?id=13588&action=edit
test case

With the attached test case I get:

$ llc -O2 -o - a.ll
[...]
f:                                      # @f
        .align  3
        .quad   .L.f
        .quad   .TOC. at tocbase
        .quad   0
        .text
.L.f:
        .cfi_startproc
# BB#0:
        mflr 0
        std 0, 16(1)
        stdu 1, -128(1)
.Ltmp0:
        .cfi_def_cfa_offset 128
.Ltmp1:
        .cfi_offset lr, 16
.Ltmp2:
        .cfi_offset r30, -16
        addis 4, 2, .LC1 at toc@ha
        std 30, 112(1)                  # 8-byte Folded Spill
        mr 30, 3
        ori 2, 2, 0
        ld 4, .LC1 at toc@l(4)
        ld 12, 0(4)
        std 2, 40(1)
        ori 2, 2, 0
        ld 4, 0(12)
        ld 11, 16(12)
        ld 2, 8(12)
        mtctr 4
        bctrl
        mr 3, 30
        ld 2, 40(1)
[...]

At this point, just after the indirect call to *g, the TOC pointer is reloaded
from the stack into r2. The problem is that the system unwinder in libgcc only
recognises this if the "ld r2,40(r1)" instruction is *immediately* after the
call instruction. In this case the post-RA scheduler has moved things around so
that it is not.

This breaks a bunch of asan test cases on PowerPC64 when the asan runtime is
built with clang, because asan's __interceptor___cxa_throw is affected by the
bug.

    AddressSanitizer-Unit ::
Asan-powerpc64-inline-Test/AddressSanitizer.CxxExceptionTest
    AddressSanitizer-Unit ::
Asan-powerpc64-with-calls-Test/AddressSanitizer.CxxExceptionTest
    AddressSanitizer-Unit ::
Asan-powerpc64le-inline-Test/AddressSanitizer.CxxExceptionTest
    AddressSanitizer-Unit ::
Asan-powerpc64le-with-calls-Test/AddressSanitizer.CxxExceptionTest
    AddressSanitizer64 :: TestCases/contiguous_container.cc
    AddressSanitizer64 :: TestCases/throw_call_test.cc
    AddressSanitizer64 :: TestCases/throw_catch.cc
    AddressSanitizer64 :: TestCases/uar_and_exceptions.cc

-- 
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/20141223/332b85f5/attachment.html>


More information about the llvm-bugs mailing list