<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 - Incorrect instcombine transform urem -> icmp+zext with vectors"
   href="https://bugs.llvm.org/show_bug.cgi?id=44186">44186</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Incorrect instcombine transform urem -> icmp+zext with vectors
          </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>Testcase from Transforms/InstCombine/vector-urem.ll:

define <4 x i32> @test_v4i32_one_undef(<4 x i32> %a0) {
  %1 = urem <4 x i32> { 1, 1, 1, undef }, %a0
  ret <4 x i32> %1
}
=>
define <4 x i32> @test_v4i32_one_undef(<4 x i32> %a0) {
  %1 = icmp ne <4 x i32> %a0, { 1, 1, 1, undef }
  %2 = zext <4 x i1> %1 to <4 x i32>
  ret <4 x i32> %2
}
Transformation doesn't verify!
ERROR: Value mismatch

Example:
<4 x i32> %a0 = < #x00000010 (16), #x00000001 (1), #x00000400 (1024),
#x00000001 (1) >

Source:
<4 x i32> %1 = < #x00000001 (1), #x00000000 (0), #x00000001 (1), #x00000000 (0)
>

Target:
<4 x i1> %1 = < #x1 (1), #x0 (0), #x1 (1), #x1 (1) >
<4 x i32> %2 = < #x00000001 (1), #x00000000 (0), #x00000001 (1), #x00000001 (1)
>
Source value: < #x00000001 (1), #x00000000 (0), #x00000001 (1), #x00000000 (0)
>
Target value: < #x00000001 (1), #x00000000 (0), #x00000001 (1), #x00000001 (1)
>


Essentially, "x urem 1" is 0 for any 'x'. However, the optimized code can
produce 0 or 1.
I guess the easiest fix is to change undef to 1 in the icmp.</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>