[llvm-bugs] [Bug 39126] New: wrong code with -disable-licm-promotion

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Sep 29 02:47:29 PDT 2018


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

            Bug ID: 39126
           Summary: wrong code with -disable-licm-promotion
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: paulsson at linux.vnet.ibm.com
                CC: llvm-bugs at lists.llvm.org

Program:

a[6];
b = 15, c, d = 11, h;
short e, g;
short *f = &e;
main() {
  for (; c < 6; c++)
    a[1] = c;
lbl_71:
  ++d;
  h = &h;
  g = 1;
  if ((*f = d) & 1)
    goto lbl_71;
  b = a[b ^ e];
  printf("checksum = %X\n", b);
}

Runs:

gcc -O1 -march=z10 -o a.out
gcc -O0 -march=z13 -o a.out
gcc -O1 -march=z13 -o a.out
clang -O0 -march=z10 -o a.out
clang -O0 -march=z13 -o a.out
clang -O3 -march=z10 -o a.out
clang -O3 -march=z13 -o a.out

All the above prints 0, while this one prints 5:

clang -O3 -march=z13 -o a.out -mllvm -disable-licm-promotion

-- 
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/20180929/4f8b82c8/attachment.html>


More information about the llvm-bugs mailing list