[llvm-bugs] [Bug 47915] New: [LoopInterchange] Loops should not interchanged due to dependencies

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 20 06:44:54 PDT 2020


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: unassignedbugs at nondot.org
          Reporter: chengeng5 at huawei.com
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201020/68617c42/attachment.html>


More information about the llvm-bugs mailing list