<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/125013>125013</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Attributor and FunctionAttrs ignore callsite attributes when inferring norecurse
</td>
</tr>
<tr>
<th>Labels</th>
<td>
ipo,
missed-optimization
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
arsenm
</td>
</tr>
</table>
<pre>
In this example, test_fake_interrupt_callsite does not get inferred as norecurse. The function is identical to test_fake_interrupt_declaration, except the norecurse information comes from the callsite and not the declaration.
```
; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -passes=attributor -attributor-manifest-internal -o - %s
; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -passes=function-attrs -o - %s
; Callsite attributes are ignored when inferring
define internal void @test_interrupt() {
call void @llvm.amdgcn.s.sendmsg(i32 1, i32 0)
ret void
}
; This infers mustprogress norecurse willreturn
define internal void @test_fake_interrupt_declaration() {
call void @fake_sendmsg_declared(i32 1, i32 0)
ret void
}
; This infers mustprogress willreturn, it missed norecurse
define internal void @test_fake_interrupt_callsite() {
call void @fake_sendmsg_callsite(i32 1, i32 0) #1
ret void
}
define internal void @reference() {
ret void
}
define void @user() {
call void @reference()
call void @test_interrupt()
call void @test_fake_interrupt_declaration()
call void @test_fake_interrupt_callsite()
ret void
}
declare void @llvm.amdgcn.s.sendmsg(i32 immarg, i32) #0
declare void @fake_sendmsg_declared(i32, i32) #1
declare void @fake_sendmsg_callsite(i32, i32)
attributes #0 = { nounwind }
attributes #1 = { nocallback willreturn }
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVVGPozYQ_jXmZUQEhlySBx6yt4rUlz601-eVsQdwD9vIY3av_fWVHTYkd7u5rVqJKAjm-_x9M8OMINK9RWzY9oFtHzMxh8H5RnhCa7LWqb-aXyyEQRPgN2GmERn_DAEpPHXiKz5pG9D7eQpPUowj6YCgHBJYF6DHANp26D0qEPGZRzl7wg18GRC62cqgnQVNoBXaoKUYIbg32RXKUXgR46MA_CZxChAGXFnjWc6bFAPSGSTovDMp6CJOWJW0xYdXnBtWHJfrU7FcxZFVD_DbH7-y6ghuCpD_DrkJXsckVI_CqF7aXBgVfwMJyCdBhBTfheB1OwfnIV_vcyOs7pBCnnxZMULuIAfGt_RfTntNZDqKbjnPtJ8v9hcxSCA8gu5j9hS8DGiXUmnbn3EKO21jUhepz04rYHWRqnMpDON7xg_Adg-sOELK8yVyHJ_N5ix8QxtCqwz1jO91xaGMVYw3BeOHBPUYEjKevntctX-JvZe0EZiZwuRd75Gu2gle9Dh6DLO3P9N9r6veN5JQi_4Fg-r_M3IlP3IFMJoI1WrwX7p6bfYPW7oC_GAJGK_Kd329J8tjhx6t_F7DHY5X6Ezo7yn_jvrHgLca9J2on7XDx2C3-b7jMzXOhz4PbYzw_VKHpQrFGxx3OvMWXL6t4U4brPgz9Gp0RDHAqsdYILButi_aKjgbvQ0rr8IifSvk16t-XzCXmZupplKH6iAybMpdtedFVdWHbGi2dXuod4X61MoWkfOaS9kJVLt6t6ux6jLd8IJvi7IqCl5u68NmX9bdp72osKykOMg9qws0Qo-blHbn-0wTzdiUCZWNosWR0hbkXE-O8ZgAxvn5W8zdFLTRfy-9weOq9E2kytu5p1hNTYFW8qDDiM1x3QNx8ZyWQX1Mc_o8fK9W05q523m8DoJs9mMzhDARq46Mnxg_9ToMc7uRzjB-iscvf_nk3Z8oA-OnZJQYPy1enxv-TwAAAP__1zKcNA">