<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=http://email.email.llvm.org/c/eJztWVlv2zgQ_jXyC2FBJHU--KG2m90CBbrb9j3gabOrqxLlpv31O6RkRUm6adIWu1skhmCJnOub4cyItHkjP2-CNBLMIsF6FQoUEIppkqcwG0T7IHoRJFtPslc2SPYByY_Wtn1AXwTkAq6DsceBh6KpYFCWp_Nt3XbNByUsDLUpVQ_3rIiymGbwNCskxWQErPlLjOOh7s2hVhLxgG7HqVNjJNJNAwic2Hm6t8wagfpj04G6nDkayWd5P49EQHbI1BZJIKMg26JO2aGrEfhLX6KUxnnuntxAgmpg2S-sKtDopMVZmgPzHoGt3GvGeER0Lea4K2bqEayTGecREkfWIe3lo9kJBI51yDGDEkfcofExIFt_FWc-5MHoZQQQMtrJ8htsdyM1g5uDPQ9FyerDWpOCJClLYyYwFjophGJ5lotcYs6KhGaSxzoh1Bmz3VD_5Vxbv_kCCiB7alQ3FqnSVKZmViGYdRiAxgeLZiMuN5rusMY0jMJoIR5OaBbf60d-bmj4Ua_Q-h1aNzB7IdUJvnsrm-FcJtfBozupLDNlP-bPrh-qinWfYfBWyUFACrK-VxUvYWrn1Mx0GLfudhP0eLG-Gmd8ElG_ot_4BM6FOPICk8oiFNpcQoV0FqpxKi3PRxLOw8gV8Zm1HfrjR7gDqWNXNzVIpS-FZpeN1r2yCKczuWpOJdy4T7WkM60vv50zoBZarpquHHUrcXWmi4kevt5u8SV-gJceOt1D0N4fTY9e1bXq0OumadHviknVORV71dojMOHZuKha7o3H-WRalDPxg3JOegT0dnzIAyFBAdYehuM_I9l7p74CZxELdvWVWFnV2wlvkd4FDAtQq1GeXc-aWowyN3yr2tk5vIw1XS78tITXeG4u5hLWvbgXkUxuRzJeGvxWAAQrS5eJrnssQCeP0dE27TmZxf3JnM9UeCV8PBvUQy0uVS3x0mjYmy_OybGx79CCbb0ou1vd1Vd9O9a7bya-W9wq_J_S6e621ifWw1gtx6yIo39O5G-lzi-fBt_3wjs9JB3eDLYd7GOSYBx6YOikut40NcKxz89HbyVDYEAP9W5e8vesOyjr8u8qTy_TeA0e182nel2aerhaH-ph4jt20LpR1UhVOu626c2UFa9qyL-yVHJv_DsGcH2RzDK3k22qFra33aVg4qjcxKPWAAT4OWMumqGWbickjXQbqN92bs_qLcMWt6kny0PfubgY7iImYP95MfnVioVL5ALjEIfR96lO40cof6dKWBxoEj9V624GWw2lNc5fUBe63Sw0CFB1DxclExs83IR4n67_T-P-N2uR_kAtyoynacEpoxGNE6GF5ERLRZhOdZwzFvMizuNE_re1qGQcURULTlQiCpFiSTTnccyZiqhI0oiSIuIaP9fiU65F14vdhbamB3wuZJ4wDgGubRzQXAtVxLrAKY64iFMcc6wVpI_ONY6pYoQncRZPvu6aqjLWSfPPfgXiqGsshKgzh6P96X3koeCe4Nbw-Xj7fLx9Pt7-iueaPzp1Ms3QI-GbqUvCIoqEwIyQVOQ8TzBsOqiMmS4iXchMQe0JrDJCvtokHyr8BJvkL3l-XskNlQUt2IoN9th0mz8H1g18NXTl5tF_VZi-H_x_FQmlBK-Om0xnJE-oSlNIEJnmWEDYdISztMjjjIhVybgq-02QbANCavUJeRXwHCT71Y8jMBsSERJhuDLYS-OQaYojxbIigpuMOCy3gqiVodMTwili1W28Sj4ceiCWprf9NRES0f0xojxgQGiNLdVm73bbO9hto5fT7_fubPBWHTrV-2MCs74czr8YoFMfTkcHSI2Vx7zxgP8GIzQVMw>53321</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Dead Code Elimination Regression at -Oz (trunk vs. 13.0.0)
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Quarub
      </td>
    </tr>
</table>

<pre>
    `cat case.c #13586`
[case.txt](https://github.com/llvm/llvm-project/files/7907437/case.txt)
```c
unsigned b;
void foo();
static short(a)(unsigned short c, int d) { return c > 63488 >> d; }
void e(int c) { b = a(c, 11); }
int main() {
  char f = 0;
  for (; f < 8; f++)
    e(f);
  if (b)
    foo();
}
```
`clang-f29256a64ac11cf59cea878c8d1ba9537db4f523 (trunk) -Oz` can not eliminate `foo` but `clang-llvmorg-13.0.0 -Oz` can.


------------------------------------------------

`clang-f29256a64ac11cf59cea878c8d1ba9537db4f523 (trunk) -Oz -S -o /dev/stdout case.c`
<details ><summary>Reduced assembly</summary><p>

```asm
main:                                   # @main
        .cfi_startproc
# %bb.0:
        pushq   %rax
        .cfi_def_cfa_offset 16
        movl    b(%rip), %eax
        xorl    %ecx, %ecx
.LBB1_1:                                # =>This Inner Loop Header: Depth=1
        cmpb    $8, %cl
        je      .LBB1_3
# %bb.2:                                #   in Loop: Header=BB1_1 Depth=1
        xorl    %eax, %eax
        testb   $96, %cl
        setne   %al
        incb    %cl
        jmp     .LBB1_1
.LBB1_3:
        movl    %eax, b(%rip)
        testl   %eax, %eax
        je      .LBB1_5
# %bb.4:
        xorl    %eax, %eax
        callq   foo
.LBB1_5:
        xorl    %eax, %eax
        popq    %rcx
        .cfi_def_cfa_offset 8
        retq
.Lfunc_end1:
        .size   main, .Lfunc_end1-main
```
</p></details>

------------------------------------------------

`clang-llvmorg-13.0.0 -Oz -S -o /dev/stdout case.c`
<details ><summary>Reduced assembly</summary><p>

```asm
main:                                   # @main
        .cfi_startproc
# %bb.0:
        andl    $0, b(%rip)
        xorl    %eax, %eax
        retq
.Lfunc_end1:
        .size   main, .Lfunc_end1-main
```
</p></details>

------------------------------------------------

`clang-f29256a64ac11cf59cea878c8d1ba9537db4f523 (trunk) -v`
<details ><summary>Output</summary><p>

```
clang version 14.0.0 (https://github.com/llvm/llvm-project.git f29256a64ac11cf59cea878c8d1ba9537db4f523)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /zdata/compiler_cache/clang-f29256a64ac11cf59cea878c8d1ba9537db4f523/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0
Found candidate GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/11.1.0
Selected GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/11.1.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
```
</p></details>

------------------------------------------------

`clang-llvmorg-13.0.0 -v`
<details ><summary>Output</summary><p>

```
clang version 13.0.0 (https://github.com/llvm/llvm-project.git d7b669b3a30345cfcdb2fde2af6f48aa4b94845d)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /zdata/compiler_cache/clang-ed403e4cb2e5c9c61d2fbb44bae03c5603290bf1/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0
Found candidate GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/11.1.0
Selected GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/11.1.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
```
</p></details>

------------------------------------------------

### Bisection
Bisected to: 8fce94f91610bc4614b1fe0bff8f143ea2b54742
Committed by: @rotateright

------------------------------------------------

`clang-8fce94f91610bc4614b1fe0bff8f143ea2b54742 -Oz -S -o /dev/stdout case.c`
<details ><summary>Reduced assembly</summary><p>

```asm
main:                                   # @main
        .cfi_startproc
# %bb.0:
        pushq   %rax
        .cfi_def_cfa_offset 16
        movl    b(%rip), %eax
        xorl    %ecx, %ecx
.LBB1_1:                                # =>This Inner Loop Header: Depth=1
        cmpb    $8, %cl
        je      .LBB1_3
# %bb.2:                                #   in Loop: Header=BB1_1 Depth=1
        xorl    %eax, %eax
        testb   $96, %cl
        setne   %al
        incb    %cl
        jmp     .LBB1_1
.LBB1_3:
        movl    %eax, b(%rip)
        testl   %eax, %eax
        je      .LBB1_5
# %bb.4:
        xorl    %eax, %eax
        callq   foo
.LBB1_5:
        xorl    %eax, %eax
        popq    %rcx
        .cfi_def_cfa_offset 8
        retq
.Lfunc_end1:
        .size   main, .Lfunc_end1-main
```
</p></details>

------------------------------------------------

Previous commit: 900cc1a226c8b8512fd3d4af90f9d7e5ecc1e722

`clang-900cc1a226c8b8512fd3d4af90f9d7e5ecc1e722 -Oz -S -o /dev/stdout case.c`
<details ><summary>Reduced assembly</summary><p>

```asm
main:                                   # @main
        .cfi_startproc
# %bb.0:
        andl    $0, b(%rip)
        xorl    %eax, %eax
        retq
.Lfunc_end1:
        .size   main, .Lfunc_end1-main
```
</p></details>
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztWVlv2zgQ_jXyC2FBJHU--KG2m90CBbrb9j3gabOrqxLlpv31O6RkRUm6adIWu1skhhCJnOub4cx4FPNGft4EaSSYRYL1KhQoIBTTJE9hN4j2QfQiSLaeZK9skOwDkh-tbfuAvgjIBVwHY48DD0VTwaIsT-fbuu2aD0pYWGpTqh7uWRFlMc3gaVZIiskIWPOXGNdD3ZtDrSTiAd2OW6fGSKSbBhA4sfN2b5k1AvXHpgN1OXM0ks_yfh-JgOyQqS2SQEZBtkWdskNXI_CXvkQpjfPcPbmFBNXAsl9YVaDRSYuzNAfmPQJbudeM8YjoWsxxV8zUI1gnM-4jJI6sQ9rLR7MTCBzrkGMGJY64Q-NjQLb-Ks58yIPRywggZLST5TfY7kZqBjcHe16KktWHtSYFSVKWxkxgLHRSCMXyLBe5xJwVCc0kj3VCqDNmu6H-y7m2fvMFFED21KhuLFKlqUzNrEKw6zAAjQ8WzUZcbjTdYY1pGIXRQjyc0Cz-rh_5uaHhR71C63do3cDuhVQn-Ntb2QznMrkOHt1JZZkp-zF_dv1QVaz7DIu3Sg4CUpD1vap4CVs7p2amw7p1t5ugx4v11bjjk4j6E_3GJ3AuxJEXmFQWodDmEiqks1CNU2l5PpJwHkauiM-s7dAfP8IdSB27uqlBKn0pNLtstO6VRTidyVVzKuHGfaolnWl9-e2cAbXQctV05ahbiaszXUz08PV2iy_xA7z00Okegvb-aHr0qq5Vh143TYt-V0yqzqnYq9YegQnP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