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

    <tr>
        <th>Summary</th>
        <td>
            dead store to static variable not eliminated
        </td>
    </tr>

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

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

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

<pre>
    Consider this test code:

```
int dummy1()
{
  static int removeme = 0;
  if (removeme)
  {
      return 0;
  }
  removeme = 1;
  return 0;
}

int dummy2()
{
  static int removeme = 0;
  if (!removeme)
    removeme = 1;
  return 0;
}

int dummy3()
{
  static int removeme = 0;
  removeme = 1;
  return 0;
}
```

My expectation was: emit "return 0" for all three.
Observed behavior: emit conditional + store and then return 0 for dummy1 and dummy2, emit only return 0 for dummy3.

Am I missing something? Why isn't this dead store eliminated?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytU02PmzAQ_TXmMioCGxI4cNhstFIPVY89GzyAK39Etkmbf18DgSbtnrpFlrE17715Y49bK27NqzVeCnQQRukhoA_QWYGEvZDsTLJtPmT3sWylCSAmrW85oRWh9R10PK0LAB94kB3MOIfaXlEjEHaGjLAdI3uI7C28qwA86MyfwzA580Qlx_O2fJLPHzB_0XbSHzXQD9dAaP5OGf_DG_uAt3_J_nzN6_zlBvjzgt2c0hr4wX1sDkAtQ6yd7mKUQm8dcKViKznEdGV_bT26KwpoceRXad1O7qwRcpbkKgqdYk3WIXAjIh_N7nJRXZttCW539rqqWKNu72BZ-ljCi4bPoKX30gzgrcbY7GYg7A2-jTeQ3hB6DOsLEMjF3QoqqaXhAUVEJqJhomY1T4IMCpsHXLDbfVy5k7xVCMaGB3oyOdWMIVzmkyP0LY5BhnFq087quFHquv0-XZz9Hs86bqPdCX1clOWhrpOxOXQZ77tDV1Be0frAsehZm-c1zcq8YG2WKN6i8g0pT6Q8J7KhGY0xGqN5Rau04xWyIqfIOa_KoiRFhppLlc6JU-uGxDWLh3YafAwq6YP_HeTx-AaDuOnzKYzWNT32mB-TxW2zWP0FkFxJcA">