<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 - [InstSimplify] Miscompilation of sdiv + urem"
   href="https://bugs.llvm.org/show_bug.cgi?id=32948">32948</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[InstSimplify] Miscompilation of sdiv + urem
          </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>david.majnemer@gmail.com, llvm-bugs@lists.llvm.org, regehr@cs.utah.edu, spatel+llvm@rotateright.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>InstSimplify miscompiles the following:

define i2 @func76883517(i2) {
  %2 = sdiv exact i2 1, %0
  %3 = sdiv exact i2 -1, %0
  %4 = urem i2 %2, %3
  ret i2 %4
}


$ opt -S a.ll -instsimplify
define i2 @func76883517(i2) {
  %2 = sdiv exact i2 1, %0
  ret i2 %2
}


Alive says:
%0 i2 = 0x3 (3, -1)
%2 i2 = 0x3 (3, -1)
%3 i2 = 0x1 (1)
%4 i2 = 0x0 (0)
%5 i2 = 0x3 (3, -1)
Source value: 0x0 (0)
Target value: 0x3 (3, -1)

<a href="http://rise4fun.com/Alive/wslA">http://rise4fun.com/Alive/wslA</a></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>