<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - -Rpass-missed=loop-vectorize says nothing at all for outer loops"
   href="https://llvm.org/bugs/show_bug.cgi?id=28374">28374</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>-Rpass-missed=loop-vectorize says nothing at all for outer loops
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </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>sean@rogue-research.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=16662" name="attach_16662" title="Repro case">attachment 16662</a> <a href="attachment.cgi?id=16662&action=edit" title="Repro case">[details]</a></span>
Repro case

Consider:

--------test.c-------
#include <stdio.h>

int foo(int *A, int *B, int n) {

#pragma clang loop vectorize(enable)
  for (int k = 0; k < n; ++k)
  {
    unsigned sum = 0;

#pragma clang loop vectorize(enable)
    for (int i = 0; i < n; ++i)
      sum += A[i] + 5;

    printf("%i", sum);
  }

 return 0;
}
---------------

$ clang --version
clang version 3.9.0 (trunk 274259)

$ clang -S -fvectorize -O3 -Rpass=loop-vectorize -Rpass-missed=loop-vectorize
-Rpass-analysis=loop-vectorize ~/Desktop/test.c
/Users/sean/Desktop/test.c:11:4: remark: vectorized loop (vectorization width:
4, interleaved count: 2) [-Rpass=loop-vectorize]
          for (int i = 0; i < n; ++i)
          ^


It helpfully says it vectorized the inner loop, but says *nothing* about the
outer loop (despite the #pragma even).

Adam Nemet said on cfe-dev that "the vectorizer does not visit outer loops and
the diagnostics is emitted in the vectorizer so we don’t get a chance to report
anything."

For a user trying to audit/tweak his loops to be vectorization-friendly, it's
frustrating that the flags that are supposed to report if/why a loop has/has
not been vectorized are not behaving reliably.</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>