<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63936>63936</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[FunctionAttrs] Recursive calls can have different effects
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jdoerfert
</td>
</tr>
</table>
<pre>
Function Attrs assumes recursive calls (or any call in the SCC) has the same effect as the SCC (at most). This is not true:
https://godbolt.org/z/fjj3r9v7q
```
@G = global i32 0
define void @bar(ptr %p) {
%pval = load ptr, ptr %p
call void @bar(ptr %pval)
store i32 0, ptr @G
ret void
}
```
The function itself, w/o the recursive call, only loads argument memory and writes global memory. The recursive call however, reads non-argument memory, at least in my understanding of `argmemonly/argmem`.
Tag (@nikic @fhahn @aeubanks)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsU92uozgMfhpzY50qNZTCBRczrZj7nfMCgRjImZB0k8BR9-lXoXR3pjpSVfDfh_3ZnwxBj5a5gdN3OF0zucTJ-eZDOfYD-5h1Tt2bdrF91M7itxh9QBnCMnNAz_3ig14Ze2lMQKDKeZT2vtmoLcaJ8eflAlTjJMNmBjkz8jBwH3F3_bxcUq2MOLsQgeoDvk86oA5oXcToF4b8G4griP1_ivEWko9aoHZ0qnMmHpwfgdp_gNrh4yP39Xr-ey8qxf57mIX4gZBfcTSukwZ1Tih-h1c8aMu4Oq0QCtFJD1Tdokeg0y0NA-fvj0zcXKs0G55xUuEteqAL_pe-522UfI24SgNUPxNDdJ73np44hfjxDHuOG8ze7_n65YjvE-Pw3JqOgc2QwD6BWrdx_ufuUsxZc98mCCj9uMxsI848O39HaRV-eh05PCl7BNKeXqFwcp-88saB54RmnX17QUxBGdGwDDHdyXzHxSr2IUqrtB3RDQilkH5M-dbcgdqHAaU4_L6qdzmm24FCWP1L94mqYZKTTS-Sl07aXwGozlSTqzqvZcbNsazqshTHgrKp6UVRUS2LY1lSd6I8P5-qiio-nuu-K0SX6YYE5eJ8rEQpiOggjmfVF1WnRDmoWnVQCJ6lNgdj1jndYKZDWLgp8zovMyM7NmGTF5HlT9yCQJTU5ptU89YtY4BCGB1i-B8l6mg2XT7Vt4kPTlf860V3vbQ4yZVR6WFgn2h-CCxkizfNi1h0nJbu0LsZqE0f2x9vN-8-uI9A7dZiAGq3Ef4NAAD__xWzS2o">