[LLVMbugs] [Bug 20802] New: [SLP vectorizer] fast-math flags are not preserved

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Aug 29 10:02:27 PDT 2014


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

            Bug ID: 20802
           Summary: [SLP vectorizer] fast-math flags are not preserved
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

There are several FP hints under:
http://llvm.org/docs/LangRef.html#fast-math-flags

Using opt built from r216678:

$ cat slp.ll
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"

define void @slp(float* %x) {
  %arrayidx2 = getelementptr inbounds float* %x, i64 1
  %arrayidx3 = getelementptr inbounds float* %x, i64 2
  %arrayidx4 = getelementptr inbounds float* %x, i64 3

  %load1 = load float* %x, align 4
  %load2 = load float* %arrayidx2, align 4
  %load3 = load float* %arrayidx3, align 4
  %load4 = load float* %arrayidx4, align 4

  %sub1 = fsub fast float 0.0, %load1   ; FAST
  %sub2 = fsub fast float 0.0, %load2   ; FAST
  %sub3 = fsub fast float 0.0, %load3   ; FAST
  %sub4 = fsub fast float 0.0, %load4   ; FAST

  store float %sub1, float* %x, align 4
  store float %sub2, float* %arrayidx2, align 4
  store float %sub3, float* %arrayidx3, align 4
  store float %sub4, float* %arrayidx4, align 4

  ret void
}

$ ./opt -basicaa -slp-vectorizer slp.ll -S
; ModuleID = 'slp.ll'
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"

define void @slp(float* %x) {
  %arrayidx2 = getelementptr inbounds float* %x, i64 1
  %arrayidx3 = getelementptr inbounds float* %x, i64 2
  %arrayidx4 = getelementptr inbounds float* %x, i64 3
  %1 = bitcast float* %x to <4 x float>*
  %2 = load <4 x float>* %1, align 4
  %3 = fsub <4 x float> zeroinitializer, %2   ; not so FAST
  %4 = bitcast float* %x to <4 x float>*
  store <4 x float> %3, <4 x float>* %4, align 4
  ret void
}

-- 
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/20140829/27297e4b/attachment.html>


More information about the llvm-bugs mailing list