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: seb...@gmail.com
          Reporter: george.burgess...@gmail.com
                CC: dber...@dberlin.org, llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to