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

    <tr>
        <th>Summary</th>
        <td>
            Compiler hits infinite loop on code after e03d254bbd54
        </td>
    </tr>

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

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

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

<pre>
    We have an internal test case which recently has started hanging when building on our machines and I finally got a chance to investigate it. When I looked into it, the compiler seems to be getting into an infinite loop, and with some help from @gregbedwell  I was able to reduce it to the following code:
```c++
double a(double c, double d) { return c >= d ? c : d; }
struct e {
  double f;
  void operator*(double);
} b;
struct {
  e g;
  double h();
  double i() {
    double j, k = h(), l = g.f >= 0 ? g.f : 0;
    j = k >= l ? k : l;
    return j;
  }
} m;
void n() {
  double o = m.i(), p = a(0, o);
  b *p;
}
```
If compiled with optimizations enabled and fast-math (`-O2 -fast-math`), the compilation hangs until you kill it or your system runs out of memory. I was able to bisect this issue back to commit e03d254bbd54.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxkVE2P8jgM_jXhYlGVtFA49MAMizSnPb7nNHGbDGlSJe4g9tevEqDDzCtFavz1-LHrWMRoBofYsu0b255WYibtQ6tusxtWnVe39g-CFl8IwoFxhMEJC4SRQIqIcNVGaggo0ZG9gRYRIolAqEALNxg3wFWjg242ViXJO_BzgFFIbRxGEE7BB_TGCWtvMHgCAVILJxHIg3FfGMkMghAMFfAnYX2A9f6CKvHxYIjxdyCNIP04GYsBIuIYU3iHMCBRypt9cw29cYYwYUwpMhG4GtIQ_Yig0U7QBz8Cq8sh4NChuqK1AB9wFRFEZzOxgGqWiVMSUvLeW-uvKZP0Cll1ZOWJlUe2K-9HMv6WTtYqPyccwfj-cZWJyuOuGD8Aa94gIM3BgQRW_cOqEyhg1TmLR1CsegPWnO6AkcIsCTCF3TXwROtZtai-vFHgJwyCfGD8uORn_LC4seYE3SI9kF9wEYYXyEcWzfj-FWQxmLvhFWCxfaaiL5BKe8bzd7BZMRT9s-wyl31XHKF8yQHwmZ0vT1ebXS_Z0f5wfPTy80W5dC9VPC6G3CT3N-0HaZ8zjoX5ZjxlVfqbZRL9z0Z0wPhxem3vr9G4ix_9c4Af8-gnMqP5T5DxLgK6NHoqj2svIq1HQRoSh125_pfDelEmxDuv70eRQfKLjDA7MhZufoaLsTaNsA9JDBBvkXCEMLsIfibwPYw4-nArfk1_ZyJKAtImgolxRuiEvCSL9ONoCLCsFN_WXae2dbFSbaUO1UGssN3smv2G7yverHTbI9_War-pN7yuK-Ryu2_qrhFK1V0jd9uVaXnJq7Iqd5t9veVNsecoqqrcoOj4gcsNq0schbGFtV9j4cOwynTa3YbzemVFhzbm1ca5w-udK-M8bbrQpph1Nw-R1aU1keI3Chmy2L4_F4o2FH9ujrTH0kMH0ROGH_Wu5mBbTTTFtAX4mfHzYEjPXSH9yPg5JXl81lPwnyiJ8XOmFhk_Z-r_BwAA___gbrIY">