<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - GVNHoist hoists a store above a load of the same memory location"
   href="https://llvm.org/bugs/show_bug.cgi?id=30216">30216</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>GVNHoist hoists a store above a load of the same memory location
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Scalar Optimizations
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>sebpop@gmail.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>george.burgess.iv@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dberlin@dberlin.org, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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. :)</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>