<html>
    <head>
      <base href="http://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 --- - [GVN, EarlyCSE, Missed Opt] Load from memory after invariant.end is undef"
   href="http://llvm.org/bugs/show_bug.cgi?id=20811">20811</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[GVN, EarlyCSE, Missed Opt] Load from memory after invariant.end is undef
          </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>Linux
          </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>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>listmail@philipreames.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=12960" name="attach_12960" title="Failing test case for GVN">attachment 12960</a> <a href="attachment.cgi?id=12960&action=edit" title="Failing test case for GVN">[details]</a></span>
Failing test case for GVN

Currently, GVN has handling to remove a load following a invariant.start with
no intervening stores since the memory is undefined and the load can be
replaced with undef.  This is an analogous case for invariant.end which is not
implemented.  Once the lifetime of a memory region has ended, the value of the
memory becomes undefined.  As a result, a load from such memory should be
replaced with undef.

Here's the example case (also attached):
define i8 @test(i8* %P) nounwind {
entry:
  call void @llvm.lifetime.end(i64 32, i8* %P)
  %0 = load i8* %P <-- this load is undefined
  ret i8 %0
}

The failing test case I've attached is for GVN, but EarlyCSE has the same
issue.  (In fact, this load is not currently removed by an pass in -O3.)  As
mentioned in 20809, it would be nice if the logic in question could be
refactored to be sharable between the two passes.</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>