[llvm-bugs] [Bug 52346] New: Dead Code Elimination Regression at -O3 (trunk&13.0.0 vs 12.0.1)

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Oct 29 04:59:22 PDT 2021


            Bug ID: 52346
           Summary: Dead Code Elimination Regression at -O3 (trunk&13.0.0
                    vs 12.0.1)
           Product: new-bugs
           Version: 12.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: theodort at inf.ethz.ch
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

cat test.c
void foo(void);
char bar(void);

static int b = 1, c;

int main() {
  int e = 0;
  int f[] = {1, 1, 1};
  b = 0;
  for (; b; b = bar())
    f[1] = e;
  for (; c < 1; c++) {
    if (!f[c])

12.0.1 at -O3 can eliminate the call to foo but neither 13.0.0 nor trunk can:

clang-12 -O3 -S -o /dev/stdout test.c | grep foo
clang-13 -O3 -S -o /dev/stdout test.c | grep foo 
        callq   foo
clang-trunk -O3 -S -o /dev/stdout test.c | grep foo 
        callq   foo

clang-trunk -v
clang version 14.0.0 (https://github.com/llvm/llvm-project.git
Target: x86_64-unknown-linux-gnu
Thread model: posix

This was introduced by

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/20211029/df98c7ca/attachment.html>

More information about the llvm-bugs mailing list