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

    <tr>
        <th>Summary</th>
        <td>
            [clang] Assertion failed in Vectorize
        </td>
    </tr>

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

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

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

<pre>
    To reproduce, compile it with -O2: clang -O2 example.c

```c
#include <stdint.h>
int a;
long b;
static int32_t c;
void d(int e, int h) {
  int f = a = 1;
  for (; a <= e; a++)
    f *= a;
  a = 0;
 for (; a < h; a++)
    b *= f;
}
long g() {}
int32_t i() {
 for (; g();)
    for (c = 3;;)
      ;
}
uint16_t j() { d(c + 1, c + 6); }
```

The error message is as follows:

```
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:9985: bool llvm::LoopVectorizePass::processLoop(llvm::Loop *): Assertion `VF.Width == BestVF && "VPlan cost model and legacy cost model disagreed"' failed.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0VE2PozgQ_TXFpTQIypCEAwfSWU4r7Rxa2ePI2AY8cjCynZ6d_fUrmySd7tmREHJ9vap6fjL3Xk-LUi3UR6hPGb-G2bpWcCf1xJeyKA7ZYOXP9tWiU6uz8ioU0AsKe1m1UagD_tBhxi9_EbAOheHLFA1U__DLalQuoDhB0d3-u2L77l5iehHmKhUCe_FB6iXkM7A_trBeAnJgx80ydplweJg-8KAF6iUw-hZQPAJvVkuUQIdYnoaNhxmoQdjfcjD5RgR2Qp7-5aMecbQOgQ7Ajin4EuMqWUDH9DX3VIwg1CWcJ4QNs3j3fIbE-Xd4wx1vfFTD_vREwRRxbsvcA3cW9FPsl8a3wgj7YYEtQ6SRWYx-SkD8dZKrXkK5-xbw-3vHRLpAoCOWSSPpuNta4qP0IYJnZbzOCpVz1uFFec8nhdoj9zhaY-wPD6z7Xx3daDFvF6De6AGof3V88aN1Fw_Un5UI1ul_FVD_p7Xrw87FugLrmuZQR90O1hpMMKwD1n1I_cq939yrs0J5H6NAh4_p6dbiph123isXtF0QdsW5z__WMsyR3UjwUflw7hFoB7RDIDp_NXxBYX3Ai5XKIF8kGjVx8fPZK7Xnk1NKAhHQHkeujZL5Jz4y2TLZsIZnqi33VLG6Luoqm9t6HMU4NvWwL5UUZckGWammLMeyItUwlemWCqqKA1HZsKKucsGIK8WHshSHai8OUBXqwrXJ4965dVOmvb-qtizqPVFm-KCMT-8IUXoG4qD1KXNtLPgyXCcPVWG0D_4dIuhg0uOzVdSnJ_K2DVEv-LiK7OpMO4ewpguhHqifdJivQy5sUsBNCLHh6ux3JQJQn-aMariN-tbSfwEAAP__i4xi6g">