[llvm-bugs] [Bug 25171] New: wrong code generated for monotonic loads and stores

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 13 16:09:14 PDT 2015


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

            Bug ID: 25171
           Summary: wrong code generated for monotonic loads and stores
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@d = global double 0.000000e+00, align 8

define void @_Z1fv() #0 {
entry:
  %0 = load atomic i64, i64* bitcast (double* @d to i64*) monotonic, align 8
  %1 = bitcast i64 %0 to double
  %add = fadd double %1, 1.000000e+00
  %2 = bitcast double %add to i64
  store atomic i64 %2, i64* bitcast (double* @d to i64*) monotonic, align 8
  ret void
}

attributes #0 = { nounwind uwtable "disable-tail-calls"="false"
"less-precise-fpmad"="false" "no-frame-pointer-elim"="false"
"no-infs-fp-math"="false" "no-nans-fp-math"="false"
"stack-protector-buffer-size"="8" "target-cpu"="x86-64"
"target-features"="+mmx,+sse,+sse2" "unsafe-fp-math"="false"
"use-soft-float"="false" }


Generates:

_Z1fv:                                  # @_Z1fv
        movsd   .LCPI0_0(%rip), %xmm0   # xmm0 = mem[0],zero
        addsd   (%rip), %xmm0
        movsd   %xmm0, (%rip)
        retq


Instead of loading and storing @d, we load and store over random instructions
within 'f'.

-- 
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/20151013/0fa042d6/attachment.html>


More information about the llvm-bugs mailing list