Issue 125013
Summary Attributor and FunctionAttrs ignore callsite attributes when inferring norecurse
Labels ipo, missed-optimization
Assignees
Reporter arsenm
    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 }
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to