[llvm-bugs] [Bug 33619] New: wrong code at -O2 and -O3 on x86_64-linux-gnu (in 64-bit mode) with "-mllvm -enable-newgvn

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 27 16:08:43 PDT 2017


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

            Bug ID: 33619
           Summary: wrong code at -O2 and -O3 on x86_64-linux-gnu (in
                    64-bit mode) with "-mllvm -enable-newgvn
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: llvm-bugs at lists.llvm.org

$ clang -v
clang version 5.0.0 (trunk 306291)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.4
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.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
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.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
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.2.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$
$ clang -O2 -w small.c
$ ./a.out
$
$ clang -O2 -w -mllvm -enable-newgvn small.c
$ ./a.out
Floating point exception (core dumped)
$


-------------------------------------


int a, b, c, d, e, i, g, j = 1;
char f;

void fn1 ()
{ 
  if (c)
    goto L5;
  for (; d < 2; d++)
    i = 1;
  goto L3;
L1:
L2:
  if (e)
    goto L4;
L3:;
  char h, k = d;
  if (j)
    { 
      b;
    L4:
      if (!i)
        goto L1;
    }
  h = f = k;
  i = ~(f * -1 / ~1U);
  g = f & h;
L5:;
  short l = ~f;
  int m = 2 / ~a;
  if (m < l)
    { 
      a = -(~0 || 0);
      goto L2;
    }
}

int main ()
{ 
  fn1 ();
  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/20170627/ac8a5fbf/attachment-0001.html>


More information about the llvm-bugs mailing list