[llvm-bugs] [Bug 48057] New: [LoopInterchange] Loops should not interchanged due to control flow

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Nov 2 22:29:48 PST 2020


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

            Bug ID: 48057
           Summary: [LoopInterchange] Loops should not interchanged due to
                    control flow
           Product: libraries
           Version: trunk
          Hardware: All
                OS: Linux
            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=true -O2 reproducer.c -w && ./a.out
0
$ clang -mllvm -enable-loopinterchange=false -O2 reproducer.c -w && ./a.out
5
$ clang -O0 reproducer.c -w && ./a.out
5

reproducer.c:

#include <stdio.h>
char b[][8] = {{}, {}, {}, {}, {5}, {}, 2, 3};
int c, d;
short e;
static char f() {
  for (; c <= 7; c++) {
    d = 4;
    for (; d; d--)
      b[d + 2][c] && (e = b[d][0]);
  }
}
int main() {
  f();
  printf("%d\n", e);
}

-- 
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/20201103/8f27a9a3/attachment.html>


More information about the llvm-bugs mailing list