<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 --- - Mere addition of template makes -Rpass-analysis=loop-vectorize fall silent"
   href="https://llvm.org/bugs/show_bug.cgi?id=28377">28377</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Mere addition of template makes -Rpass-analysis=loop-vectorize fall silent
          </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=16665" name="attach_16665" title="repro case">attachment 16665</a> <a href="attachment.cgi?id=16665&action=edit" title="repro case">[details]</a></span>
repro case

Maybe a dupe of #28374, but...

If I have 2 identical functions, but template one, clang's
-Rpass-analysis=loop-vectorize flag will talk about the one, but fall silent
about the templated one:

-------test.cxx---------
template <typename T>
void test1(int *A, int *B, int Length)
{
    for (int i = 0; i < Length; i++) 
    {
        switch(A[i]) 
        {
          case 0: B[i] = 1; 
                break;
          case 1: B[i] = 2; 
                break;
          default: B[i] = 3;
        }
    }
}

void test2(int *A, int *B, int Length)
{
    for (int i = 0; i < Length; i++) 
    {
        switch(A[i]) 
        {
          case 0: B[i] = 1; 
                break;
          case 1: B[i] = 2; 
                break;
          default: B[i] = 3;
        }
    }
}
------------------------

$ 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.cxx
/Users/sean/Desktop/test.cxx:21:9: remark: loop not vectorized: loop contains a
switch statement [-Rpass-analysis=loop-vectorize]
        switch(A[i]) 
        ^
/Users/sean/Desktop/test.cxx:19:5: remark: loop not vectorized: use
-Rpass-analysis=loop-vectorize for more info [-Rpass-missed=loop-vectorize]
    for (int i = 0; i < Length; i++) 
    ^


It says it can't vectorize the 2nd loop (lines 19-21 ish), but says nothing at
all about the first (templated) function.</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>