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

    <tr>
        <th>Summary</th>
        <td>
            [optimization] clang remove the infinite loop and leave unreachable
        </td>
    </tr>

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

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

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

<pre>
    If I want to compile this file with `clang main.cpp -O1` and run `a.out`, I will got `zsh: trace trap ./a.out`
```c++
// main.cpp
int main() {
  while (true) {
 }
}
```
Is it reasonable?


The IR looks like
```
define noundef i32 @main() local_unnamed_addr #0 {
 unreachable
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0UlGPmzAM_jXmxToUnELhgYe7q9D6NGna-ykFU7ILCUrCVbtfP4V2XSdtkmWM_fH5w_pUCPpsmVsoX6A8ZGqNk_PtF_b-VWnRiH12csPP9jjiES_KRowOezcv2jDGSQccU3XRcUKoRG-UPeOstM37ZcGnrwVUApUd0K82AVTu1giVAHpNhNoYPLuYJp9hAvmM0aueU14wB-rueHEA8ZyKLXqglxTXLnVA3X3rtalt3DpANVCDsL-BES9TUgxUR7_y3zPYH26U9-L3xuvrMaCO6FkFZ9XJMMjuhnvI3yfG4zc0zr0HNPqd_0k18Kgto3WrHXhELQlhJx4kG9cr87Zaq2Ye3tQweASS4kHuaj2rftqE_Ed2NrRyaGSjMm6Lqi7KuqqJsqmVSkhZSh6HPalx31RVPZ6avqJSlKUoh0y3JEiKXVEWDe0F5Y2igXayaJTc1UwCdoJnpU1uzMecO3_OdAgrtxUVZZMZdWITNlsRWb7gNgSi5DLfpm-eTus5wE4YHWL4wxJ1NJsf3RL1rD9V1M5CecCruTzP7iN5j1HbUVsdOZ162VxmWH3w412y1Zt2inEJIG9GOes4rae8dzNQl7beHk-Ldz-4j0DdpjUAddu__AoAAP__51HtXw">