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

    <tr>
        <th>Summary</th>
        <td>
            Wrong code at -O1 on x86_64-linux_gnu (InstComine)
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          shao-hua-li
      </td>
    </tr>
</table>

<pre>
    This is a recent regression. Clang at -O1 produces the wrong code.

Bisect to https://github.com/llvm/llvm-project/commit/ad7f02010f32bff28fec139e103ad0240e160aa9, which was committed by @nikic 

Compiler explorer: https://godbolt.org/z/ze8b3KcKs

```console
% cat a.c
int printf(const char *, ...);
int a, b, d, f, h;
static int c = 8;
static int e = 1;
char g;
void l(int *m) {
  if (f) {
    e = 0;
    for (;;) {
      h = 0;
      for (; h;)
        ;
 }
  }
}
int main() {
  int *i = &c;
  l(i);
  if (c)
 j:
  k:;
    else {
      ;
      if (e)
        goto j;
 }
  g = b;
  if (b)
    goto k;
  printf("%d\n", a);
}
%
% clang -O0 a.c &&./a.out
0
% clang -O1 a.c &&./a.out
%
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVMGOozgQ_ZriUgoyZSBw4JBOFGk1h7mstMeRMQY87dgRNtM9-_Urkw5h072HlRKnUvX8eM-US3ivB6tUA8ULFKdEzGF0U-NH4XbjLHZGJ63rfjd_jtqj9ihwUlLZgJMaJuW9djbFoxF2QBFw9z3D6-S6WSqPYVT4Njk7oHSdSoGdgB1u64v2SgYMDscQrh74AegMdB50GOc2le4CdDbm1_1nd53cTyUD0Fm6y0XHQHT7nhHLWM-p7XuqeiUzXquMcdExypnKSiZEDXTEt1HLEd-Ex9v2oDpsfyPkzOpXLXGr7eguV23UhOr9atykJuCHZ5mua50JqZsGoPPf8auqln-T3_yWCUp2-0hnvTPqI0sFShFQpPKW0DbgddI29EBVhAaUo5gQ6BC1p2kKVAN_eaBFzLdx6eLSx2VcET6IoCVGoETgJ6y-KqmllK2l5ZHD-veX0x0aoCpigQ4XoBph_1FF1D0CVf1TFj9o2coTc72LZhYV_OXTDsTxiz3bXTdvVG-riA847E_30hquQdR_EdpGqicLN2d6eTpQKTcCFufbY787lg8dP2M_fBRfY7zVr4xXzz6fDN4I1Sdjgwsukn9hb1i0tp9Utf8iWQheN6C1u4AIqOigONolPMZWeph8nB4Vm2ZdbvfuO4stGw8KqEzjBUzdHG4w9hmd_Tf6wX6_IEnX8K7mtUhUk5U1q1jBWJWMTc45K6suy6TMyrqrM1ntldr3XU5ZVVVVohtixNmeZxkxTmUq86pnVLSc7fcyLwrImboIbdI4R-KNTbT3s2rKnIo6MaJVxi_Dj8iqN1yK8WyKUzI1y-xp58FDzoz2wT9Ygg5GNX-t8-0-_pzF96r8UeY7o-38_mOwc3xDf1gfju6ibXzfyTyZ5n9PvkWaBzov0v8JAAD__3LSinc">