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

            Bug ID: 52038
           Summary: Missed loop vectorization with reduction and ptr
                    load/store inside loop
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Loop Optimizer
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]

void test1(int *p, int *t, int N) {
    for (int i = 0; i != N; i++) *t += p[i];
}

void test2(int *p, int *t, int N) {
    if (N > 1024) // hint, N is not small
        for (int i = 0; i != N; i++) *t += p[i];
}

void test3(int *p, int *t, int N) {
    if (N > 1024) { // hint, N is not small
        int s = 0;
        for (int i = 0; i != N; i++) s += p[i];
        *t += s;
    }
}

test3 is successfully vectorized with LLVM, GCC, ICC. Sadly, only ICC can catch
test1 and test2.

https://godbolt.org/z/PzoYd4eEK

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to