[llvm-bugs] [Bug 30216] New: GVNHoist hoists a store above a load of the same memory location

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 30 22:47:33 PDT 2016


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

            Bug ID: 30216
           Summary: GVNHoist hoists a store above a load of the same
                    memory location
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: sebpop at gmail.com
          Reporter: george.burgess.iv at gmail.com
                CC: dberlin at dberlin.org, llvm-bugs at lists.llvm.org
    Classification: Unclassified

Hi! I have a repro of a bug for you (on r280192):

$ echo '
@A = external global i8
@B = external global i8*

define i8* @Foo() {
  store i8 0, i8* @A
  br i1 undef, label %if.then, label %if.else

if.then:
  store i8* null, i8** @B
  ret i8* null

if.else:
  %1 = load i8*, i8** @B
  store i8* null, i8** @B
  ret i8* %1
}
' | opt -gvn-hoist -S


@A = external global i8
@B = external global i8*

define i8* @Foo() {
  store i8 0, i8* @A
  store i8* null, i8** @B
  br i1 undef, label %if.then, label %if.else

if.then:                                          ; preds = %0
  ret i8* null

if.else:                                          ; preds = %0
  %1 = load i8*, i8** @B
  ret i8* %1
}

The hoist of the store to @B above a load of @B is illegal. This won't repro
without the store to @A at the top. :)

-- 
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/20160831/9256f1a1/attachment.html>


More information about the llvm-bugs mailing list