[LLVMbugs] [Bug 20600] New: BBVectorizer moves stores across calls

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Aug 8 18:05:54 PDT 2014


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

            Bug ID: 20600
           Summary: BBVectorizer moves stores across calls
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: sanjoy at playingwithpointers.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Running "opt -bb-vectorize" on the following IR

  target datalayout = "e"

  declare void @external(i32*)

  define void @foo(i32* %x, i32* %y) {
  entry:
    %y1.addr = getelementptr i32* %y, i32 0
    %y1 = load i32* %y1.addr
    %y2.addr = getelementptr i32* %y, i32 1
    %y2 = load i32* %y2.addr

    %x1 = getelementptr i32* %x, i32 0
    store i32 %y1, i32* %x1, align 4

    call void @external(i32* %x)

    %x2 = getelementptr i32* %x, i32 1
    store i32 %y2, i32* %x2, align 4
    ret void
  }

results in

  target datalayout = "e"

  declare void @external(i32*)

  define void @foo(i32* %x, i32* %y) {
  entry:
    %y1.v.i0 = bitcast i32* %y to <2 x i32>*
    %y1 = load <2 x i32>* %y1.v.i0
    %0 = bitcast i32* %x to <2 x i32>*
    store <2 x i32> %y1, <2 x i32>* %0, align 4
    call void @external(i32* %x)
    ret void
  }


This is problematic since the transform effectively moves a store to
'%x' from after the call to '@external' (an opaque call that may be
reading '%x') to before it.

-- 
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/20140809/4b27cf47/attachment.html>


More information about the llvm-bugs mailing list