[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


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

            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])
      foo();
  }
}

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
73453e7adecbcc7208ceb70d5e55086ffbd1de3a)
Target: x86_64-unknown-linux-gnu
Thread model: posix

This was introduced by
https://github.com/llvm/llvm-project/commit/a26f1bf67ec70f72e64101cf483b26466928fc38

-- 
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