<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/132351>132351</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Basic-aa seems to be able to improve accuracy with minor improvements
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
GINN-Imp
</td>
</tr>
</table>
<pre>
Testcase: https://godbolt.org/z/1oPjedz5E
```llvm
define i1 @f1(ptr %RP) {
BB:
%B = srem i8 0, 1
%L4 = load float, ptr %RP, align 4
%G = getelementptr ptr, ptr %RP, i8 %B
store float 0.0, ptr %G, align 4
ret i1 false
}
```
Output of `-aa-pipeline=basic-aa -passes='aa-eval' -print-all-alias-modref-info"`:
```
MayAlias: float* %G, float* %RP
```
After propagating the %B value, its analysis becomes more accurate:
```llvm
define i1 @f2(ptr %RP) {
BB:
%B = srem i8 0, 1
%L4 = load float, ptr %RP, align 4
%G = getelementptr ptr, ptr %RP, i8 0
store float 0.0, ptr %G, align 4
ret i1 false
}
```
Output of `-aa-pipeline=basic-aa -passes='aa-eval' -print-all-alias-modref-info"`:
```
Function: f2: 2 pointers, 0 call sites
MustAlias: float* %G, float* %RP
```
In addition, if the value of %B is not 0, its analysis results will change, which means that it seems to have the ability to propagate the value of %B itself. So, it looks like there's a little bit of refinement here that would make it more accurate?
I've done my best to rule out UB in IR, but if there is one here, thanks for pointing it out. Also, if there is a good way to identify UB behavior in IR, I would be very grateful.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzcVUFv4zYT_TX0ZSBDoiXLPuhgx5-DAN9ug7T9ASNpJHFDkQI5suH99QWpZJMmi_ZQ9FJAsAHODN-8N48keq96Q1SJ4iiK0wpnHqyr7h--fk0exmlV2_ZW_UaeG_QkNgcYmCcvNgchz0Kee9vWVvPaul7I83chz5l9_Ebt9-J_Ij2Eb5sun9aXUaSHljplCFQGIk-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