<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=http://email.email.llvm.org/c/eJztWVmTmzgQ_jX4RWUKJM4HP2TszG6qUpXdJO8uXdiacAWE48mv35bAGE-8EzvXZmvGhQGpW62vW91qSbBK3C-cyONUI05b6XLkYBLjIIBKx1s53gsnvLEUvddOuHJwstW6bh3ywsG3cG2U3nbM5VUBhTzfHR7zuqnuJNdQzFQuW3jGqRdHJIK3USBOh06gN3vxvtxqqhVHqtSIAgDoGDkE_vGN78Qrh9x8webgF6znwZFp4hmw5_ng4gdW5uDlUCeOdYd2u0oJlFUVaG1eDdzzIiVwANUA7MkImjXI1EIDuE5pCKnMEEegBzsg-2ONpB_Gno7s7AFfj2yKCiFjnuG1kbprSgNPjAwj2QAvqCqPwNFoFzlKPYobR2gs8pyWm3mGUxxGNAoo932ehSmXNIkTngif0TQksWBBFmJi8OumKz-Y3uZvCAgAjytRWWkkc1WokmqJoNYoBTTWaTR2YhyqajZzn7ie602auwOayX1-5e9Ewvdqhebv0LyC2lshd3Bvtai6Q2gdjUeWQmqq8hbM_RJKbVcUtLmHwlspOi4Fom0rC5ZD1dKIGelQrs3jFHR_0bboa-y4ksFJHv05RoXAsw0GkanLM7UG9240hPAQj5YPh4y5non8A2vdtduP8ARSQ_enEoTM1jyj6yrLWqmRH41kXtS5bRR4Jvqo9bawUfVxOvDSotoZyeyEaGP1pKs7afp7fXPjrf2-si_EU5iDrKEpCGFnu9xXTY8rlD3b8DZqW9UHMfxxZZORCjH4cYrLn-L6ip20bPUp7n9XPnk4TvhRAzzQ4a6oR0nkCK_GNFcb8Iw0MI28fepNdUku8DELiMBM_PL9VrXoVVnKBr2uqhr9KamQjRGxkrXeApN_Fk9yMZ7wQjwwnZYWg-E_wFhZ3c9g4TTPjfHMvHSlcwKbcSh6hk2K_cWjY_zg4Jhif0bAXXl0hHhqEfLTRmjqm_ysS00whQ-dM_gpIzWJ37NmmtBHyPIqO8szUTL11dH4WVfytSzFyWzptuqzkdCn3SWasM0nM_CDRGsTQN1P_Tav2MTxIAf8kKT3ZZZ9YunsawlgOpn_L0f425Y1u0tG-k2n605fM7590QJDO9m0qiqRH1jXu3qX4QIDulS7Mee_p81GauNa-yRaR8EcNC6rT-U8V2W3n2_KbuDbwoJcoKISMjfcddWqwSteleBaeS7FStmZEnB9FlRTs8mpihp2Ps2aU76VpuKqMYAG7OAxt1VXCrPeFUqYZfIfyyXMjLZn2IVU5dBz1zbGLooZi3EO90Gvmk9Uwre-7_qu922io-AK4e9kDoMD8f9DpS5HsEWXa2X0BXGu2eNA7IOoR7gIHtjg5RTiY7J-nzn5V8Yi-Y5YFDGLopQRSjwShDzjguFMSEyzKAsSSgOWBkkQiv82FqUIPCIDzrAMecojX-CMsSBgVHqEh5FHcOqxzH-Oxacci2YuNhe6US3gMyazhL4IcHVlgLIQ-7Ef4TQLozgTwsdemsBsnoZZxtM4xl7MU1jWDCapikJp05rd2xEIvDt6_wG80vd--CxyKbQnuOZ7PsJ4PsL4GRvk5yOM5yOM5yOMX5Si_2rkTlVdi7jNqsbUMuVJGpPM51ESpzQIgxAWczTjEhamnKdJEMRhHGRn8-WljZ9gvvzdzkhmYkFESlI6o53eVs3i7442HZt1Tb64-kulatvOfqoMCcF4tl3ghKUpCSkPM0yjxOMpJnEkY9ivh4JKf5ZTJvN2Yb5RYlzKT8iKgHcnXM2-H4FaYA9jD9ZrfoKjMHETTpNQZJhniYdpSmAkJVgtd40cF3aKs2ZhRbJu0wIxV61uj0TwMcg-Ui76j6ozrXQuFyuzo1rCjgq9HL7Emf3fW7lpZGu3glRbTz-cCqFd6w7bQ0gHM4t5YQH_A3QFD64>53322</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Dead Code Elimination Regression at -O3 (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 #7244`
[case.txt](https://github.com/llvm/llvm-project/files/7907636/case.txt)
```c
static int a[] = {1};
static int *b = &a[0];
static int **c = &b, **d = &b;
void foo(void);
static int *e() {
  for (;;) {
    if (a[0])
      break;
    if (b)
      foo();
  }
  return *d;
}
int main() { *c = e(); }
```
`clang-f29256a64ac11cf59cea878c8d1ba9537db4f523 (trunk) -O3` can not eliminate `foo` but `clang-llvmorg-13.0.0 -O3` can.


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

`clang-f29256a64ac11cf59cea878c8d1ba9537db4f523 (trunk) -O3 -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
        cmpl    $0, a(%rip)
        movq    b(%rip), %rax
        je      .LBB0_1
.LBB0_7:
        movq    %rax, b(%rip)
        xorl    %eax, %eax
        popq    %rcx
        .cfi_def_cfa_offset 8
        retq
.LBB0_1:
        .cfi_def_cfa_offset 16
        testq   %rax, %rax
        je      .LBB0_8
# %bb.2:
        movq    %rax, %rcx
        jmp     .LBB0_3
        .p2align        4, 0x90
.LBB0_8:                                # =>This Inner Loop Header: Depth=1
        jmp     .LBB0_8
        .p2align        4, 0x90
.LBB0_5:                                #   in Loop: Header=BB0_3 Depth=1
        callq   foo
        movq    b(%rip), %rax
        movl    a(%rip), %edx
        movq    %rax, %rcx
        testl   %edx, %edx
        jne     .LBB0_7
.LBB0_3:                                # =>This Inner Loop Header: Depth=1
        testq   %rcx, %rcx
        jne     .LBB0_5
# %bb.4:                                #   in Loop: Header=BB0_3 Depth=1
        xorl    %edx, %edx
        xorl    %ecx, %ecx
        testl   %edx, %edx
        je      .LBB0_3
        jmp     .LBB0_7
.Lfunc_end0:
        .size   main, .Lfunc_end0-main
```
</p></details>

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

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

```asm
main:                                   # @main
        .cfi_startproc
# %bb.0:
        xorl    %eax, %eax
        retq
.Lfunc_end0:
        .size   main, .Lfunc_end0-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: b52171629f567fdd120987db95ffc977207c960a
Committed by: @jaykang10

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

`clang-b52171629f567fdd120987db95ffc977207c960a -O3 -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
        cmpl    $0, a(%rip)
        movq    b(%rip), %rax
        je      .LBB0_1
.LBB0_7:
        movq    %rax, b(%rip)
        xorl    %eax, %eax
        popq    %rcx
        .cfi_def_cfa_offset 8
        retq
.LBB0_1:
        .cfi_def_cfa_offset 16
        testq   %rax, %rax
        je      .LBB0_8
# %bb.2:
        movq    %rax, %rcx
        jmp     .LBB0_3
        .p2align        4, 0x90
.LBB0_8:                                # =>This Inner Loop Header: Depth=1
        jmp     .LBB0_8
        .p2align        4, 0x90
.LBB0_5:                                #   in Loop: Header=BB0_3 Depth=1
        callq   foo
        movq    b(%rip), %rax
        movl    a(%rip), %edx
        movq    %rax, %rcx
        testl   %edx, %edx
        jne     .LBB0_7
.LBB0_3:                                # =>This Inner Loop Header: Depth=1
        testq   %rcx, %rcx
        jne     .LBB0_5
# %bb.4:                                #   in Loop: Header=BB0_3 Depth=1
        xorl    %edx, %edx
        xorl    %ecx, %ecx
        testl   %edx, %edx
        je      .LBB0_3
        jmp     .LBB0_7
.Lfunc_end0:
        .size   main, .Lfunc_end0-main
```
</p></details>

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

Previous commit: e9c8973f1c6879a4545329afceb66cc98447574f

`clang-e9c8973f1c6879a4545329afceb66cc98447574f -O3 -S -o /dev/stdout case.c`
<details ><summary>Reduced assembly</summary><p>

```asm
main:                                   # @main
        .cfi_startproc
# %bb.0:
        xorl    %eax, %eax
        retq
.Lfunc_end0:
        .size   main, .Lfunc_end0-main
```
</p></details>
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztWVmT2jgQ_jXmRYXLlnw-8JCBzG6qUpXdJO-UTtDEV2yZMPn127KNMRN2Ark2WzOUAUvdan3d6kOyWSnuF07kcWoQp410OXIwiXEQQKfjrRzvhRPedBSzN064cnCyNaZqHPLCwbdwbbTZtszlZQ6NLNsd_uZVXd5JbqCpdCYb-I9TL45IBHejQJwOk8Bs3cX7dmOo0RzpwiAKAGBi5BD4xje-E68ccvMFm4NfsJ4HR3aIZ8Ge54OLH1iZg5dDn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