<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/65051>65051</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`SE::isKnownPredicate` is not commutative
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ychen306
</td>
</tr>
</table>
<pre>
More specifically, `SE::isKnownPredicate(CmpInst::ICMP_NE, ...)` is not commutative and may return different results depending on the order of the 2nd and 3rd operands.
See this Godbolt [link](https://godbolt.org/z/sxo98bKM7) for example, where I got `DependenceInfo` (which uses `isKnownPredicate` behind the scene) to conclude that the load *doesn't* alias with the first store and *does* alias with the second store (but the stores have the same pointers and alignments).
```llvm
store i32 0, ptr %arrayidx2, align 4
%t = load float, ptr %add.ptr, align 4
store i32 1, ptr %arrayidx2, align 4
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMU9FurDYQ_RrzMrrIDAu7PPCwN3u3WkWpIuUDKmMPi1tjI3vIZvv1FZA0VRtVV0JYHp8zc-bYo1KyV0_Uiuq7qE6ZmnkIsb3rgXwp66wL5t4-hUiQJtK2t1o5dxf4AKKWLz9EeRTl0aZHH27-OZKxWjEJPDyM08Un3s4vD0_Pv_36Y2HleS6wEbUEm8AHBh3GcWbF9pVAeQOjukMknqMHY_ueInmGSGl2nMDQRN5Yf4XggQeCEA1FCP26QW_WFGU0ECaKypuUC3kS8rj9X4iAB5vgl2C64BhE9d1Z_4eoTgIPA_OUFsF4Fni-bpA8xKvA858Cz-ktNIfu8WkvsIE-RKA3NU6OlrZuA0WCC1wDL8acVp3kNV18H5ZuBR5ug9UDzInSAvmPZ7WEjgbrzdpL0uRpKcQBdPDazWbRrng9dUEZEHg0gZIXuGeBR1DOqgQ3y8OK6W1MDImXu1tceYd_gUykgzfvUIGHbt6qrIEEg3qlba9GgilYzxTTmlM5e_UjeU4Cmw-ra7l9zr2OWwjec9sSQS52TRxBYKViVHdr3nCJrblg98EQWDGI8rT12rug-J9MY_KJ4xe8z0rFT1X6W25m2tI0ZaMyaou6KbHGom6yoe32TVMUUha63u1qpKIrdSdVvyt3stsXmNkWJZbygAfEspZNbpRWVKl9X0mNCjuxkzQq6_LFkuVFZTalmdq6klWROdWRSx8DGNsF9K2br0nspLOJ0yeNLTtq_2_yvhysbI6u_dfztjzMXa7DKPC83tS2fJti-J00CzyvGpPA8yrzrwAAAP__ZsNTCg">