[llvm-bugs] [Bug 28377] New: Mere addition of template makes -Rpass-analysis=loop-vectorize fall silent

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 30 12:56:18 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28377

            Bug ID: 28377
           Summary: Mere addition of template makes
                    -Rpass-analysis=loop-vectorize fall silent
           Product: new-bugs
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: sean at rogue-research.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 16665
  --> https://llvm.org/bugs/attachment.cgi?id=16665&action=edit
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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160630/9c42e5f1/attachment-0001.html>


More information about the llvm-bugs mailing list