<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/63798>63798</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Dead Code Elimination Regression (trunk vs 16)
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

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

<pre>
    https://godbolt.org/z/esv1zKddc

Given the following code:

```C
void foo(void);
static int a = 5;
static int **c, **d;
static int *e = &a;
static int **f = &e;
static int ***g = &c;
static short(h)(short b) {
    if (!(((b) >= 1) && ((b) <= 1))) {
        __builtin_unreachable();
    }
 return 0;
}
static void i(int **) {}
static int **k(int **j) {
 *j = 0;
    h(0);
    return *g;
}
int main() {
    int **l;
    if (a)
        ;
    else {
        int *m;
        f = &m;
        d = &e;
        l = k(d);
        i(l);
        if (e == 0)
            ;
        else
            foo();
 ;
    }
    h(0 <= 9);
}

```
clang-trunk -O3 does not eliminate the call to foo:

```asm
main: # @main
# %bb.0:
        cmpl    $0, a(%rip)
        je      .LBB0_1
# %bb.4:
        xorl    %eax, %eax
        retq
.LBB0_1:
        pushq   %rax
        movq    %rsp, %rax
        movq    %rax, f(%rip)
        cmpq    $0, e(%rip)
        je      .LBB0_3
# %bb.2:
        callq   foo@PLT
.LBB0_3:
        addq    $8, %rsp
        xorl    %eax, %eax
        retq
.Lfunc_end0:
```

clang-16.0.6 -O3 eliminates the call to foo:

```asm
main:                                   # @main
# %bb.0:
        xorl    %eax, %eax
        retq
.Lfunc_end0:
```

Bisects to 7739be7c6b6d017bf6b4445c5010e59314655995 (@jrbyrnes)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0Vk2P4ygQ_TWVC-oIgz8POfTHZA870q5We29hU4npISZjcHZmfv0KsNO209GsRlrLcoB6vKpXVSYW1qpjh7iD7Amy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