[LLVMbugs] [Bug 20780] New: "optimized" __atomic_*_{1, 2, 4, 8, 16} libcalls use broken calling convention

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Aug 27 15:51:03 PDT 2014


            Bug ID: 20780
           Summary: "optimized" __atomic_*_{1,2,4,8,16} libcalls use
                    broken calling convention
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


double a, b, c; void g() { __atomic_exchange(&a, &b, &c, 5); }
unsigned long long d, e, f; void h() { __atomic_exchange(&d, &e, &f, 5); }

Clang generates this nonsense:

define void @_Z1gv() #0 {
  %0 = load double* @b, align 4
  %call = call double @__atomic_exchange_8(i8* bitcast (double* @a to i8*),
double %0, i32 5)
  ret void

declare double @__atomic_exchange_8(i8*, double, i32)

define void @_Z1hv() #0 {
  %0 = load i64* @e, align 4
  %call = call i64 bitcast (double (i8*, double, i32)* @__atomic_exchange_8 to
i64 (i8*, i64, i32)*)(i8* bitcast (i64* @d to i8*), i64 %0, i32 5)
  ret void

Note that we bitcast the function and use the wrong calling convention for both

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/20140827/1a19d3ef/attachment.html>

More information about the llvm-bugs mailing list