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

            Bug ID: 47915
           Summary: [LoopInterchange] Loops should not interchanged due to
                    dependencies
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedb...@nondot.org
          Reporter: chenge...@huawei.com
                CC: llvm-bugs@lists.llvm.org

$ clang -mllvm -enable-loopinterchange -O2 reproducer.c -w && ./a.out
4096
0
4096
0

$ clang -O0 reproducer.c -w && ./a.out
4096
4096
4096
4096

reproducer.c:

#include <stdio.h>
int a;
int c[4][4];
*f = &a;

void test_deps() {
    for (int i = 0; i <= 3; i++) {
        for (int j = 0; j <= 3; j++) {
            *f ^= 0x1000;
            c[j][i] = *f;
        }
    }
}

main() {
    test_deps();
    for (int k = 0; k < 4; k++)
        printf("%d\n", c[0][k]);
}

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

Reply via email to