<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 - opt hangs in LoadStoreVectorizer"
   href="https://bugs.llvm.org/show_bug.cgi?id=38517">38517</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>opt hangs in LoadStoreVectorizer
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jesper.antonsson@ericsson.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=20672" name="attach_20672" title="reproducer with nested load">attachment 20672</a> <a href="attachment.cgi?id=20672&action=edit" title="reproducer with nested load">[details]</a></span>
reproducer with nested load

Running 
  opt -load-store-vectorizer -o tmp.opt.ll tmp.ll
with the attached reproducer, the LoadStoreVectorizer hangs in an endless loop.

The originating src program consists of a nested load, where the inner load's
result is used for indexing the outer load.

A somewhat shallow analysis by me indicates that the areConsecutivePointers()
function do some SCEV magic to find that the pointers for these loads are
consecutive, but it doesn't seem to me that they are. Then when vectorization
has been performed, the IR references has a loop, and when the reorder()
function is applied to it, it follows that loop endlessly.

This is the original c-program for reference:

 #include <stdint.h>

 uint32_t a = 0;
 uint32_t b[1][3] = { { 0, 0, 0 } };
 const uint16_t c = 1;

 int main() { 
   b[(2u & b[a % 1][2u % 3]) % 1][c % 3]; 
 }</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>