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

    <tr>
        <th>Summary</th>
        <td>
            Infinite loop in compiler after commit 115c1888077ceff05b827a1b254d24abd6ee2b41
        </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>
    One of our internal tests started failing with the compiler timing out and I bisected it back to commit 115c1888077ceff05b827a1b254d24abd6ee2b41. I have reduced the code to the following:
```C
void init(void *data, unsigned size) {
  unsigned char *bytes = (unsigned char *)data;
  for (unsigned i = 0; i != size; ++i)
    bytes[i] = i;
}
typedef char schar;
typedef short __attribute__((ext_vector_type(4))) short4;
typedef schar __attribute__((ext_vector_type(32))) schar32;
typedef short __attribute__((ext_vector_type(16))) short16;
typedef union {
  short4 a;
  long b;
} union_short4_long;
typedef union {
  schar32 a;
  short16 b;
} union_schar32_short16;
long test24_id5239;
void test24() {
  union_schar32_short16 id5231;
  short16 id5233{4};
  union_short4_long id5236;
  init(&test24_id5239, sizeof(test24_id5239));
  id5236.b = test24_id5239;
  short16 id5234 = __builtin_shufflevector(id5236.a, id5236.a, 4, 7, 7, 5, 3, 2,
                                           3, 5, 7, 1, 1, 1, 6, 2, 1, 0);
  short16 id5232(id5233 | id5234);
  id5231.b = id5232;
  volatile schar32 id5230(id5231.a);
}
```
If compiled with `-mavx` and optimizations enabled (`-O2`), with a compiler built from the previous commit 4236a10717013b00f16811fcacb538ea8dc082ea, the compilation completes in a fraction of a second.

If the same compilation is repeated with a compiler built from 115c1888077ceff05b827a1b254d24abd6ee2b41, the compilation runs seemingly forever. Our automation kills the compile after 2 minutes automatically.

Compile command line: `clang -c -O2 -mavx test.cpp -o test.o`.

@davemgreen, can you take a look?
</pre>
<img width="1px" height="1px" alt="" src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