[llvm-bugs] [Bug 34422] New: wrong code with "-mllvm -polly -mllvm -enable-newgvn -O3" in both 32-bit and 64-bit modes on x86_64-linux-gnu

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Sep 1 22:54:30 PDT 2017


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

            Bug ID: 34422
           Summary: wrong code with "-mllvm -polly -mllvm -enable-newgvn
                    -O3" in both 32-bit and 64-bit modes on
                    x86_64-linux-gnu
           Product: Polly
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Optimizer
          Assignee: polly-dev at googlegroups.com
          Reporter: chengniansun at gmail.com
                CC: llvm-bugs at lists.llvm.org

I have to enable both polly and newgvn to trigger this bug. But I think the bug
is in polly. 

$ clang-trunk -v
clang version 6.0.0 (trunk 312331)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ clang-trunk -mllvm -polly -mllvm -enable-newgvn -O3 small.c ; ./a.out
l_2760=1
0
$ clang-trunk -mllvm -enable-newgvn -O3 small.c ; ./a.out
l_2760=1
1
$ clang-trunk -O3 small.c ; ./a.out
l_2760=1
1
$ cat small.c
int printf(const char *, ...);
static int a, b, c, h, m;
static char d = 3;
int e;
int f[2];
short g, k = 5, n;
int j;
int l;
int fn1() {
  int o = 3;
  for (;;) {
    int p;
    h = 10;
  LABEL_T1T1d:
    printf("l_2760=%llu\n", (long long)1);
    if (!d)
      continue;
    for (;;) {
      int i;
      g = 2;
      for (; g; g--) {
        f[e] = f[b];
        if (h) {
          char q;
          n = g;
          g = n;
          m = o;
          q = d;
          j = o - ~c ^ q;
          o = k && l + j;
          d = ~a;
          if (!(m || k))
            goto LABEL_T1T1d;
          if (k < 1) {
            printf("g_555=%lld\n", (long long)d);
            break;
          }
          j = o = m;
          d = q;
        }
        c = l;
      }
      return b;
    }
  }
}

int main() {
  fn1();
  printf("%d\n", n);
  return 0;
}
$

-- 
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/20170902/4bd1483a/attachment.html>


More information about the llvm-bugs mailing list