<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 --- - InstCombine transform missing associativity of boolean and operator"
   href="http://llvm.org/bugs/show_bug.cgi?id=20814">20814</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>InstCombine transform missing associativity of boolean and operator
          </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=12964" name="attach_12964" title="Failing test case for InstCombine">attachment 12964</a> <a href="attachment.cgi?id=12964&action=edit" title="Failing test case for InstCombine">[details]</a></span>
Failing test case for InstCombine

InstCombine appears to be missing a transform based on the fact that it doesn't
recognize boolean and is associative.  Without the extra 'b' variable, this
example nicely gets folded into a single equality check, but this optimization
is inhibited in this case.

define i1 @test1(i32 %i, i1 %b) {
; CHECK: icmp eq i32 %i, 0
; CHECK-NOT: slt
; todo: check and, return
entry:
  %0 = icmp slt i32 %i, 1
  %1 = icmp sgt i32 %i, -1
  %and1 = and i1 %0, %b
  %and2 = and i1 %and1, %1
  ret i1 %and2
}</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>