<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Dead Code Elimination Regression at -O3 (trunk vs 12.0.1)"
   href="https://bugs.llvm.org/show_bug.cgi?id=52102">52102</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Dead Code Elimination Regression at -O3 (trunk vs 12.0.1)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>theodoros.theodoridis@inf.ethz.ch
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
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 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
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


<a href="https://github.com/llvm/llvm-project/commit/183bbad1d78a4bf445ec4db1ce01673f6a7feb37">https://github.com/llvm/llvm-project/commit/183bbad1d78a4bf445ec4db1ce01673f6a7feb37</a>
introduced this regression</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>