<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/94676>94676</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[LoopFusion] Loop fusion misses optimization opportunities
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mc-cat-tty
</td>
</tr>
</table>
<pre>
Negative dependence test is too conservative; it fails in scenarios like this:
```C++
void twoloop(int a[], int b[], int n) {
int t = 0;
for (int i=0; i<n; ++i) {
a[i] = t;
}
for (int i=0; i<n; ++i) {
b[i] = t;
}
// ...
}
```
For reference, the following command has been used: `opt -p mem2reg,loop-rotate,loopfusion twoloop.ll`.
load-load and store-store access patterns shouldn't prevent the optimization from executing.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysU82OozgQfpriUgK5DYTkwKE7UU6rfQdjCvCucSG7SG_v048gSU_3nOYwyDLU7_dRn8qk5MZA1EL9BvUlM6tMHNvZ5tZILvKRddx_tH_TaMTdCHtaKPQULKFQEnQJhRkth0TxtudA-YZOcDDOJ3QBk6VgouOE3v1LKJNLUL6CuoB6hYO6nzPot-3s3hu7HuWdPfMC-uiCoLnzA33Gzey-mwH0CaF5lOPuQ0EoL6igfLifwYEjPro6KC9q5wvlOWwfdxrul37bszFwUF_2rvLZFRGayx8B6H4bABH0FfQVi6J4RD5TngP9WnHliJEGiptu28xkIhzYe353YUTL82xCj5NJ2BEFXBP1UL4iHBQvgvmCM8060gj6vGmSRxYj9LCGNTkOT70K7-Ggiq_wnk2fbxduKEk4Ur7faKyllHAxIhRDwjTx6vsAuhFcIt0oyM6VF3Gz-9_IBjREnpH-I7uKC2OR9W3Zn8qTyah9aV6aRlX1scmmtrF9aaxqulLTcFKlob5uamOGurKD7crMtVrpSh3UQSt1qppCd8fupabhWJtaDZWFStFsnC-8v80FxzFzKa3UnqpDc8i86cin5-LEdkvKu3VMUCnvkqSfZeLE7yv2F_Ny3ee1Cb1Z-Bjf7FKi9P1PeVk4yhqcOErZGn07iSz79uz6j06mtSssz6CvG9jjlS-R_yEroK874QT6eud8a_WPAAAA__8h1C6Z">