<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 --- - Some of the GVN assume-equal tests seem quite broken"
   href="https://llvm.org/bugs/show_bug.cgi?id=31749">31749</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Some of the GVN assume-equal tests seem quite broken
          </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>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>dberlin@dberlin.org
          </td>
        </tr>

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

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Assume-equal.ll has some tests that make no sense, or otherwise look very
broken.

Even with assume support, NewGVN doesn't get them for this reason.

Example:
; CHECK-LABEL: define i32 @_Z1ij(i32 %p)
define i32 @_Z1ij(i32 %p) {
entry:
  %cmp = icmp eq i32 %p, 42
  call void @llvm.assume(i1 %cmp)

  ; CHECK: br i1 true, label %bb2, label %bb2
  br i1 %cmp, label %bb2, label %bb2
bb2:
   ; CHECK-NOT: %cmp2 =
  %cmp2 = icmp eq i32 %p, 42
  ; CHECK-NOT: call void @llvm.assume(
  call void @llvm.assume(i1 %cmp2)

  ; CHECK: br i1 true, label %bb2, label %bb2
  br i1 %cmp, label %bb2, label %bb2

  ; CHECK: ret i32 42
  ret i32 %p
}

The ret here is outside bb2 (because the branch terminates it).

NewGVN considers it unreachable, and so ignores it. It would delete it but we
don't delete terminators to avoid breaking the CFG.

We believe block ret is unreachable
  BasicBlock Dead:
ret:                                              ; No predecessors!
  ret i32 %p

Z1ij is similar.

If we are trying to test that %p gets replaced with 42, i believe it should be 
br i1 %cmp, label %ret, label %bb2
...
ret:
ret i32 p

Which NewGVN with assume support gets.




I can't figure out what Z1il is testing for :)
we do what it wants though
z1im ditto.

Wanted a second opinion, so flagging this.</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>