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

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 7 05:56:02 PDT 2021


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

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

cat case.c                                                                     
      bisections
static int a, b = -2, c[1];
void foo(void);
int main() {
  if ((c[0] &= (1 % b == 0)) > 1)
    foo();
  b = 1;
}


trunk can no longer eliminate foo:

clang-12 -v
clang version 12.0.1 (https://github.com/llvm/llvm-project.git
fed41342a82f5a3a9201819a82bf7a48313e296b)
Target: x86_64-unknown-linux-gnu


clang-12 case.c -S -O3 -o /dev/stdout
...

main:                                   # @main
        .cfi_startproc
# %bb.0:
        movzbl  b(%rip), %eax
        andl    %eax, c.0(%rip)
        movb    $1, b(%rip)
        xorl    %eax, %eax
        retq

clang-trunk -v
clang version 14.0.0 (https://github.com/llvm/llvm-project.git
73346f58486d29c0d2687af1208fa146168d62d8)
Target: x86_64-unknown-linux-gnu


clang-trunk case.c -S -O3 -o /dev/stdout
...
main:                                   # @main
        .cfi_startproc
# %bb.0:
        pushq   %rax
        .cfi_def_cfa_offset 16
        movzbl  b(%rip), %eax
        andl    c.0(%rip), %eax
        movl    %eax, c.0(%rip)
        cmpl    $2, %eax
        jb      .LBB0_2
# %bb.1:
        callq   foo
.LBB0_2:
        movb    $1, b(%rip)
        xorl    %eax, %eax
        popq    %rcx
        .cfi_def_cfa_offset 8
        retq


https://github.com/llvm/llvm-project/commit/183bbad1d78a4bf445ec4db1ce01673f6a7feb37
introduced this regression

-- 
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/20211007/b64be1f2/attachment.html>


More information about the llvm-bugs mailing list