<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/90206>90206</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[CVP] Inappropriate folding with `llvm.assume`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
YanWQ-monad
</td>
</tr>
</table>
<pre>
For the IR
``` llvm
define i32 @src(i32 noundef %x) {
%r = add i32 %x, -1
%17 = icmp sgt i32 %r, -1
tail call void @llvm.assume(i1 %17)
ret i32 %r
}
```
`CorrelatedValuePropagationPass` will fold `%17` to `true` from the knowledge of `llvm.assume`, which should be inappropriate, because it drops the information from `llvm.assume` after optimization:
``` llvm
define i32 @src(i32 noundef %x) {
%r = add i32 %x, -1
ret i32 %r
}
```
Link: https://godbolt.org/z/6q3zWcbjn
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8U01v5CgQ_TX4UuoW4K_2wYekW5Yi7SG7h0R7xKZsk2DwAk7v5NePwBNNT3Kay0iWrCpePV7Vo4T3ajKILSnvSXnJxBZm69p_hXn--7BYI2TWW_mt7ayDMCM8_EPohdA7UtH9A63flj0ncVQGQeUcSEG9Gwg_xcDYzUgcgfDyf8IbIPX9XgAx5YDkFxBS7oUJc4YDu4GwOmHUsKzgp_ABdL8Ag1AaBqE1vFklo4Ko7Ci83xaMSthORXjzQe3whmtvq7586u9H-JE8W-dQi4DySegNH51dxSSCsuZReB_ncVVaw2i1hFidbqwoBBvD4DaM0ejsksb5auxVo5wQ7BgBt5Jj9Rmusxpm8LPdtIQeQRmxrs6uTomAEdDjIDaPoAJIZ1efeJUZrVuSrv2yL9wgxoAO7BrUot4TkuR3n7r9Qxb_rg9_KfNK8juYQ1h9VM07wrvJyt7qcLRuIrx7J7yr_svfn4f-xWSyzWWTNyLDltWsYHnZlCybW1qc-qEWTVlQrKuRDYzmNe0R82oUpWSZajnlBS14xXjJc3asi55hVfSnuuGnMWekoLgIpY9pvNZNmfJ-w7ahnFaZFj1qn5aLc4NXSIeE87hrro01h36bfHytygf_kyWooNNWnp8eSXmBh1vf0_tSZoKrCvNXb7PN6fbTcFSYt_442IXwLvm5_w6rsy84BMK7JM0T3iXp3wMAAP__n6Ezhg">