<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 - Miscompile with opt -loop-vectorize"
   href="https://bugs.llvm.org/show_bug.cgi?id=47751">47751</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Miscompile with opt -loop-vectorize
          </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>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>Loop Optimizer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>efriedma@quicinc.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>ayal.zaks@intel.com, craig.topper@gmail.com, david.green@arm.com, florian_hahn@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=24028" name="attach_24028" title="Testcase">attachment 24028</a> <a href="attachment.cgi?id=24028&action=edit" title="Testcase">[details]</a></span>
Testcase

opt -loop-vectorize makes the attached testcase behave incorrectly.

The IR testcase is runnable: compile with llc, then run.  If it's built
correctly, it should produce "3 1 2 4 5 6".  After vectorization, it instead
produces "2 1 2 4 5 6".

I think the memcheck is getting emitted incorrectly?  It looks like the
vectorized loop assumes the memory operations don't overlap.  There is in fact
overlap at runtime; I guess the memcheck is supposed to detect that, but it
looks like that detection is failing somehow.  At first glance, the check looks
like it's in the right form, but maybe something is going wrong in SCEV.

Not sure when this regressed, but it looks like it's been this way for at least
a year.

Not sure who to CC; has anyone looked at runtime checks recently?</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>