<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/136302>136302</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Basic-aa incorrectly reports NoAlias for equivalent constant pointers
</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/5Ghx98qdY
Since both `@ptr1` and `@ptr2` point to the same constant (`@global_var`), the result should be MustAlias or at least MayAlias—not NoAlias.
```llvm
@global_var = constant i32 0
@ptr1 = constant ptr @global_var
@ptr2 = constant ptr @global_var
define void @foo() {
entry:
%p = load ptr, ptr @ptr1, align 8
%q = load ptr, ptr @ptr2, align 8
ret void
}
```
opt (trunk) -aa-pipeline=basic-aa -passes='aa-eval' -print-all-alias-modref-info:
```
Function: foo: 2 pointers, 0 call sites
NoAlias: ptr* @ptr1, ptr* @ptr2
```
We've done our best to ensure this IR contains no undefined behavior. If there is any UB we're missing, we’d appreciate clarification.
Thanks!
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMVMFu4zYQ_ZrRZSCDoqRIOuigrOtFDptDu0XRUzGSRha7NKmQlFP36wvKMeLkUCxgwODw6fHNvEeS9-pomFsoH6HcJ7SG2br269Pzc_p0WpLejpf2O_swkGfIO5xDWDzkHcgDyMPRjr3VYWfdEeThX5CH8uv8T1O_jH-C6H5TZmDsbZgRHgQUYgkugweBZMb3ioyVxSoTMFgMM6OnE-NgjQ9kAoKsr9ijtj3pv87k4lo2IL9scMd-1QH9bFc9Ys_4bfWh04o8WocUUDP5gN_oshXhFwm1gKYwNuCz3Wo7EF0k3X5an09xfX8iQr5_l6RyieIKiS193FyCw49qb0D5E0DRjTwpw3i2aozbk7VxArJBqB5BdGyCu0QDRIcIslw2Um1pjIRxJm-827DlFyStjgbrG_7lf_DyM95x2IREZdX-fkggOrts5gS3mh9RX0qULmphrQxDvu_JqyElwnQh79lDvgdZEaV8Jg2ywnRxyoSUtE4pmpCe7Oh4SpWZ7LXB-9MOqxmCsiaGMM4k71BeY8POR90CB9IavQrsN_Fv3m5UzdZrdz-XDxX56TQQ3R8MsjozjtYw2tVhz36LKBu_OsYwK49Pv0Y_Aynj0VhczdW9GMOZzsq6HT5NMaWOUXkkc8HfH_E1UjvGk_JemWNU88q3XDYj0rI4HhQFxkGTU5MaKPa-uyr7PpP54UFmydjmY5M3lHCbVUXR1FldVMncFlU-cdXXA1FfUlGWk6iI5DD2dVlmZZ6oVgpZiiKrszwTxcMu68WUj6OQFdVTyRIKwSdSehdvQ7zfifJ-5TbLH3IhE009a7-9GlIafsVtF6SMj4hr40dpvx49FEIrH_w7TVBBc_t4C4cyg3WOh6Av6HixLvibcThZh_yyqjNpNuHu4ry5nqxOt58eJBXmtd8N9gTysF3k61-6OPs3DwHkYVPqQR7eWjm38r8AAAD__0HAkWk">