http://llvm.org/bugs/show_bug.cgi?id=21065

            Bug ID: 21065
           Summary: Similar loops are not always vectorized
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

The generated IR (with clang -O3) from this code:

#include <stdlib.h>

void foo(double * d, unsigned int size)
{
    for (unsigned int i = 0; i < size; ++i)
    {
    d[i] += 1; 
    }
}

void bar(unsigned int size)
{
    double * d = malloc(size * sizeof(double));
    for (unsigned int i = 0; i < size; ++i)
    {
    d[i] += 1; 
    }
    foobar(d);
}

void oof(unsigned int size)
{
    double * d = malloc(size * sizeof(double));
    foo(d, size);
    foobar(d);
}

shows that the loop in foo is vectorized but not in bar.
The call to foo in oof has been inlined but the vectorization has been removed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to