<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55645>55645</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[SCEV] applyLoopGuards drops information on SCEV builtin_assumes()
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
komalon1
</td>
</tr>
</table>
<pre>
applyLoopGuards tries to rewrite a SCEV expression using assumes.
The order of the assumes in the source code affects the rewritten SCEV and sometimes we lose information.
An example is [(https://godbolt.org/z/vYnvKcrME )]url where the vectorizer can't prove tripcount % VF = 0 despite the assumes with that information.
If the order of the assumes is changed as in [https://godbolt.org/z/jMG47jsEh]url code is optimized.
This is since the assume (tripcount > 0) rewrites a new SCEV that loses the divisibility information.
Need to think of a way to conserve the already rewritten expression of a certain value.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyFUktv2zAM_jX2hVjg-pXm4EO2JsWwdZcNBXoaZImOlcqiIcnO0l8_2k63rCgwwJZB0iK_B2tS50r0vTl_JervB-GUh-A08kng8OR0QBDw_dPuEfBX79B7TRYGr-0BhPdDh34VJXdRsv3RIpBT6IAaCBxcyqDtHHoanESQpLjUNCiDn_PLlIB2mSKs4l87DHq6e0Iw5JF7NOQ6EXj4CpZ5W8uIRNcbrnqIio9RetuG0Pso20bpnp8DqZpMWJE7cPTC7_hkxy_SPewgSjdRcTc4A6cWHc5IRsZETr8wBSlslK4D9I5GnBTpJQ028LUCHvcQZXeQgELfT_pckz3p0HJChH8gL4g_L7q8L5IH2Qp7QMWpSTIm9D82x4f7fH30u_bCZJaWG1HP4jEN9ccZPQ9g0-Q1WmZze0Ut20HCsrza7tl3i6fFlZnR5MTimdKj9rrWRofzO0S_IdPgBQqtts8TUwEncZ4ykqxHN15QGIdCna824GrF5lsSXRAsxijMgJfmyxmrKlObbCPioIPBiuWagLIS8HaflaPeX6MEuuxaPWgTtP15MYHlYP4xS1m9kZ5NHeqVpI4DY8bXzwdejyMvDYeaW0wd9kVR5kXcVpkoyqaQ8jYt67zI8wLFulR13mxumjVmIjaiRuMn4Aw61lWapGlSpFlS5nm-XpUql2LdbJqmuJFlIqM8wU5os5oGT0sQu2rGUA8Hz0WjffB_i0xJHyzia38xhJZc9UydMGRv4hlvNYP9DeJTXKI">