llvm-project/llvm/test/CodeGen/AMDGPU/annotate-existing-abi-attributes.ll
Shilei Tian 7dbd6cd294
[AMDGPU][Attributor] Make AAAMDFlatWorkGroupSize honor existing attribute (#114357)
If a function has `amdgpu-flat-work-group-size`, honor it in `initialize` by
taking its value directly; otherwise, it uses the default range as a starting
point. We will no longer manipulate the known range, which can cause issues
because the known range is a "throttle" to the assumed range such that the
assumed range can't get widened properly in `updateImpl` if the known range is
not set properly for whatever reasons. Another benefit of not touching the known
range is, if we indicate pessimistic state, it also invalidates the AA such that
`manifest` will not be called. Since we honor the attribute, we don't want and
will not add any half-baked attribute added to a function.
2024-12-11 16:47:51 -05:00

131 lines
4.5 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-globals
; RUN: opt -mtriple=amdgcn-unknown-amdhsa -S -passes=amdgpu-attributor %s | FileCheck %s
; Check handling for pre-existing attributes on function declarations
declare void @marked_no_workitem_id_x() "amdgpu-no-workitem-id-x"
declare void @marked_no_workitem_id_y() "amdgpu-no-workitem-id-y"
declare void @marked_no_workitem_id_z() "amdgpu-no-workitem-id-z"
declare void @marked_no_workgroup_id_x() "amdgpu-no-workgroup-id-x"
declare void @marked_no_workgroup_id_y() "amdgpu-no-workgroup-id-y"
declare void @marked_no_workgroup_id_z() "amdgpu-no-workgroup-id-z"
declare void @marked_no_dispatch_ptr() "amdgpu-no-dispatch-ptr"
declare void @marked_no_queue_ptr() "amdgpu-no-queue-ptr"
declare void @marked_no_implicitarg_ptr() "amdgpu-no-implicitarg-ptr"
declare void @marked_no_dispatch_id() "amdgpu-no-dispatch-id"
define void @call_no_workitem_id_x() {
; CHECK-LABEL: define {{[^@]+}}@call_no_workitem_id_x
; CHECK-SAME: () #[[ATTR0:[0-9]+]] {
; CHECK-NEXT: call void @marked_no_workitem_id_x()
; CHECK-NEXT: ret void
;
call void @marked_no_workitem_id_x()
ret void
}
define void @call_no_workitem_id_y() {
; CHECK-LABEL: define {{[^@]+}}@call_no_workitem_id_y
; CHECK-SAME: () #[[ATTR1:[0-9]+]] {
; CHECK-NEXT: call void @marked_no_workitem_id_y()
; CHECK-NEXT: ret void
;
call void @marked_no_workitem_id_y()
ret void
}
define void @call_no_workitem_id_z() {
; CHECK-LABEL: define {{[^@]+}}@call_no_workitem_id_z
; CHECK-SAME: () #[[ATTR2:[0-9]+]] {
; CHECK-NEXT: call void @marked_no_workitem_id_z()
; CHECK-NEXT: ret void
;
call void @marked_no_workitem_id_z()
ret void
}
define void @call_no_workgroup_id_x() {
; CHECK-LABEL: define {{[^@]+}}@call_no_workgroup_id_x
; CHECK-SAME: () #[[ATTR3:[0-9]+]] {
; CHECK-NEXT: call void @marked_no_workgroup_id_x()
; CHECK-NEXT: ret void
;
call void @marked_no_workgroup_id_x()
ret void
}
define void @call_no_workgroup_id_y() {
; CHECK-LABEL: define {{[^@]+}}@call_no_workgroup_id_y
; CHECK-SAME: () #[[ATTR4:[0-9]+]] {
; CHECK-NEXT: call void @marked_no_workgroup_id_y()
; CHECK-NEXT: ret void
;
call void @marked_no_workgroup_id_y()
ret void
}
define void @call_no_workgroup_id_z() {
; CHECK-LABEL: define {{[^@]+}}@call_no_workgroup_id_z
; CHECK-SAME: () #[[ATTR5:[0-9]+]] {
; CHECK-NEXT: call void @marked_no_workgroup_id_z()
; CHECK-NEXT: ret void
;
call void @marked_no_workgroup_id_z()
ret void
}
define void @call_no_dispatch_ptr() {
; CHECK-LABEL: define {{[^@]+}}@call_no_dispatch_ptr
; CHECK-SAME: () #[[ATTR6:[0-9]+]] {
; CHECK-NEXT: call void @marked_no_dispatch_ptr()
; CHECK-NEXT: ret void
;
call void @marked_no_dispatch_ptr()
ret void
}
define void @call_no_queue_ptr() {
; CHECK-LABEL: define {{[^@]+}}@call_no_queue_ptr
; CHECK-SAME: () #[[ATTR7:[0-9]+]] {
; CHECK-NEXT: call void @marked_no_queue_ptr()
; CHECK-NEXT: ret void
;
call void @marked_no_queue_ptr()
ret void
}
define void @call_no_implicitarg_ptr() {
; CHECK-LABEL: define {{[^@]+}}@call_no_implicitarg_ptr
; CHECK-SAME: () #[[ATTR8:[0-9]+]] {
; CHECK-NEXT: call void @marked_no_implicitarg_ptr()
; CHECK-NEXT: ret void
;
call void @marked_no_implicitarg_ptr()
ret void
}
define void @call_no_dispatch_id() {
; CHECK-LABEL: define {{[^@]+}}@call_no_dispatch_id
; CHECK-SAME: () #[[ATTR9:[0-9]+]] {
; CHECK-NEXT: call void @marked_no_dispatch_id()
; CHECK-NEXT: ret void
;
call void @marked_no_dispatch_id()
ret void
}
;.
; CHECK: attributes #[[ATTR0]] = { "amdgpu-no-workitem-id-x" "uniform-work-group-size"="false" }
; CHECK: attributes #[[ATTR1]] = { "amdgpu-no-workitem-id-y" "uniform-work-group-size"="false" }
; CHECK: attributes #[[ATTR2]] = { "amdgpu-no-workitem-id-z" "uniform-work-group-size"="false" }
; CHECK: attributes #[[ATTR3]] = { "amdgpu-no-workgroup-id-x" "uniform-work-group-size"="false" }
; CHECK: attributes #[[ATTR4]] = { "amdgpu-no-workgroup-id-y" "uniform-work-group-size"="false" }
; CHECK: attributes #[[ATTR5]] = { "amdgpu-no-workgroup-id-z" "uniform-work-group-size"="false" }
; CHECK: attributes #[[ATTR6]] = { "amdgpu-no-dispatch-ptr" "uniform-work-group-size"="false" }
; CHECK: attributes #[[ATTR7]] = { "amdgpu-no-queue-ptr" "uniform-work-group-size"="false" }
; CHECK: attributes #[[ATTR8]] = { "amdgpu-no-implicitarg-ptr" "uniform-work-group-size"="false" }
; CHECK: attributes #[[ATTR9]] = { "amdgpu-no-dispatch-id" "uniform-work-group-size"="false" }
;.