[llvm-bugs] [Bug 39597] New: vectorization differences

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Nov 8 23:53:35 PST 2018


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

            Bug ID: 39597
           Summary: vectorization differences
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: trass3r at gmail.com
                CC: llvm-bugs at lists.llvm.org

void foo(unsigned* x)
{
    for (int i = 0; i < 8; ++i)
            x[i] = (x[i] % 3 == 0) ? 0 : x[i];
}

void bar(unsigned* x)
{
    for (int i = 0; i < 8; ++i)
        if (x[i] % 3 == 0)
            x[i] = 0;
}

$ clang -O3 -march=haswell -Rpass="loop|vect" -Rpass-missed="loop|vect"
-Rpass-analysis="loop|vect"

<source>:3:5: remark: completely unrolled loop with 8 iterations
[-Rpass=loop-unroll]
<source>:9:5: remark: completely unrolled loop with 8 iterations
[-Rpass=loop-unroll]
<source>:4:18: remark: Stores SLP vectorized with cost -17 and with tree size 8
[-Rpass=slp-vectorizer]

$ clang -O3 -fno-unroll-loops -march=haswell -Rpass="loop|vect"
-Rpass-missed="loop|vect" -Rpass-analysis="loop|vect"

<source>:3:5: remark: vectorized loop (vectorization width: 8, interleaved
count: 1) [-Rpass=loop-vectorize]
<source>:9:5: remark: vectorized loop (vectorization width: 8, interleaved
count: 1) [-Rpass=loop-vectorize]


The generated code is different in all 4 cases:
https://godbolt.org/z/7EaJfc

-- 
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/20181109/dddac143/attachment.html>


More information about the llvm-bugs mailing list