[llvm-bugs] [Bug 47035] New: Possible outer loop vectorization missed which is vectorized by GCC

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Aug 7 06:03:52 PDT 2020


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

            Bug ID: 47035
           Summary: Possible outer loop vectorization missed which is
                    vectorized by GCC
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: mauri_mustonen at hotmail.com
                CC: llvm-bugs at lists.llvm.org

Hi!

I've been playing around with this simple code which outer loop is vectorized
by GCC just fine https://gcc.godbolt.org/z/hf6q58. This doesn't get vectorized
bt GCC if 'restrict' keyword is removed or inner loop count is not know at
compile time.

void foo1(const double* restrict in_a,
        const double* restrict in_b,
        double* restrict out)
{
    for (int i = 0; i < 100; ++i) {
        double a = in_a[i];
        double b = in_b[i];
        for (int j = 0; j < 10000; ++j) {
            a = a + b;
        }
        out[i] = a;
    }
}

GCC generated code use ymm registers to add 4 doubles at the same time and LLVM
generated code use xmm scalar registers to add one double at the time.

I've been reading vectorizer source code and I know LLVM only support innermost
loop vectorization. There are some plans for the vectorization plan (VPlan) to
enable outer loop vectorization in the future but couldn't find updates about
it and it seems quiet at the moment. So I'm also asking what is the status of
the VPlan or similar changes to enable outer loop vectorization in LLVM? And I
mean to contribute too, so I could also help with this support. Some pointers
about VPlan would be nice and is it still a valid plan?

-- 
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/20200807/ee64b302/attachment.html>


More information about the llvm-bugs mailing list