<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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: incorrect transformation 'x > (x & undef)' -> 'x > undef'"
   href="https://bugs.llvm.org/show_bug.cgi?id=44383">44383</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Instcombine: incorrect transformation 'x > (x & undef)' -> 'x > undef'
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

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

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

        <tr>
          <th>Keywords</th>
          <td>miscompilation
          </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>nunoplopes@sapo.pt
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>lebedev.ri@gmail.com, llvm-bugs@lists.llvm.org, regehr@cs.utah.edu, spatel+llvm@rotateright.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following transformation in
Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sgt-to-icmp-sgt.ll
is incorrect:

define <3 x i1> @p3_vec_splat_undef() {
  %x = call <3 x i8> @gen3x8()
  %tmp0 = and <3 x i8> %x, { 3, undef, 3 }
  %ret = icmp sgt <3 x i8> %x, %tmp0
  ret <3 x i1> %ret
}
=>
define <3 x i1> @p3_vec_splat_undef() {

  %x = call <3 x i8> @gen3x8()
  %1 = icmp sgt <3 x i8> %x, { 3, undef, 3 }
  ret <3 x i1> %1
}

Transformation doesn't verify!
ERROR: Value mismatch

Example:

Source:
<3 x i8> %x = < poison, #x00 (0), poison >
<3 x i8> %tmp0 = < poison, #x00 (0), poison >
<3 x i1> %ret = < poison, #x0 (0), poison >

Target:
<3 x i8> %x = < poison, #x00 (0), poison >
<3 x i1> %1 = < poison, #x1 (1), poison >
Source value: < poison, #x0 (0), poison >
Target value: < poison, #x1 (1), poison >


The transformation does 'x > (x & undef)' -> 'x > undef'.
Take x=0, undef=-1, and we get '0 > 0' -> '0 > -1'.</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>