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

    <tr>
        <th>Summary</th>
        <td>
            Failure to infer `%arg` is a constant
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            llvm:optimizations,
            missed-optimization
      </td>
    </tr>

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

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

<pre>
    I tried the following code:

```llvm
define i64 @src(i64 noundef %arg) {
bb:
  switch i64 %arg, label %bb1 [
    i64 0, label %bb2
 i64 1, label %bb1
  ]

bb1:
  unreachable

bb2:
  ret i64 %arg
}

define i64 @tgt(i64 noundef %arg) {
bb:
  ret i64 0
}
```

We can know that `%arg` is zero.

alive2: https://alive2.llvm.org/ce/z/iqgz5F
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUUkGPpCwQ_TV4qUwHS7H14GFmOiZfvtOe9oxYKrs0zALOZPvXb9DuGbv3tImRwHuvXtUDGYKeLFHLxAsTp0wucXa-PWlpv_2f9W743f4H0WsaIM4EozPGfWg7gXIDseKZ8RPjt3_Ft8-Y9_N2NNCoLYGuSmAlD14xrNPGusUONAJDIf3EsAF2fNkkff9ZFiB86KjmTX-lvoKRPZm07_scUt9XMqw8_kDBK5yw_FF-kzJx2k-SkK8mFutJqln2hu5JuCN5ivs2N97xrup9GHGK_xjGzYI_Vr_lvjf7TqCkhZ_WfUCcZYSEbwYVBx3gQt4d9gpp9DulkWCO8S0kY-wYdtv5IV3qwaX-OkUMuwvDTv-aLqLLhrYYmqKRGbX5MedV2fCGZ3NbVnLEui5UOYzjUB1Vn6tqxEZINQpRyUy3yLHkRX7kZV7n_EBlXtdUl4oqUWDesJLTWWrz6Z7pEBZqayFEk603Gdani7g-uuLZvUV91hcZtbOBITJ8ZYhnHQINT3swYeKU-TYJn_plCqzkRocYvsyijobaTmqzeILoQNuR_F9RSlDOhihtzBZv2vv4Jh3npT8od2bYrU1uy9Obdz9IxRRjmikw7Nax_gQAAP__NYcFvw">