Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ declare void @streaming_compatible_f() #0 "aarch64_pstate_sm_compatible"

; Function @streaming_callee doesn't contain any operations that may use ZA
; state and therefore can be legally inlined into a normal function.
define void @streaming_callee() #0 "aarch64_pstate_sm_enabled" {
; CHECK-LABEL: define void @streaming_callee
define void @non_streaming_callee() #0 {
; CHECK-LABEL: define void @non_streaming_callee
; CHECK-SAME: () #[[ATTR1:[0-9]+]] {
; CHECK-NEXT: call void @streaming_compatible_f()
; CHECK-NEXT: call void @streaming_compatible_f()
Expand All @@ -22,24 +22,25 @@ define void @streaming_callee() #0 "aarch64_pstate_sm_enabled" {
}

; Inline call to @streaming_callee to remove a streaming mode change.
define void @non_streaming_caller_inline() #0 {
; CHECK-LABEL: define void @non_streaming_caller_inline
define void @streaming_caller_inline() #0 "aarch64_pstate_sm_enabled" {
; CHECK-LABEL: define void @streaming_caller_inline
; CHECK-SAME: () #[[ATTR2:[0-9]+]] {
; CHECK-NEXT: call void @streaming_callee()
; CHECK-NEXT: call void @streaming_compatible_f()
; CHECK-NEXT: call void @streaming_compatible_f()
; CHECK-NEXT: ret void
;
call void @streaming_callee()
call void @non_streaming_callee()
ret void
}

; Don't inline call to @streaming_callee when the inline-threshold is set to 1, because it does not eliminate a streaming-mode change.
define void @streaming_caller_dont_inline() #0 "aarch64_pstate_sm_enabled" {
; CHECK-LABEL: define void @streaming_caller_dont_inline
define void @non_streaming_caller_dont_inline() #0 {
; CHECK-LABEL: define void @non_streaming_caller_dont_inline
; CHECK-SAME: () #[[ATTR1]] {
; CHECK-NEXT: call void @streaming_callee()
; CHECK-NEXT: call void @non_streaming_callee()
; CHECK-NEXT: ret void
;
call void @streaming_callee()
call void @non_streaming_callee()
ret void
}

Expand Down
83 changes: 42 additions & 41 deletions llvm/test/Transforms/Inline/AArch64/sme-pstatesm-attrs.ll
Original file line number Diff line number Diff line change
Expand Up @@ -583,67 +583,67 @@ entry:



declare void @streaming_body() "aarch64_pstate_sm_enabled"
declare void @nonstreaming_body()

define void @streaming_caller_single_streaming_callee() #0 "aarch64_pstate_sm_enabled" {
; CHECK-LABEL: define void @streaming_caller_single_streaming_callee
; CHECK-SAME: () #[[ATTR2]] {
; CHECK-NEXT: call void @streaming_body()
define void @nonstreaming_caller_single_nonstreaming_callee() #0 {
; CHECK-LABEL: define void @nonstreaming_caller_single_nonstreaming_callee
; CHECK-SAME: () #[[ATTR1]] {
; CHECK-NEXT: call void @nonstreaming_body()
; CHECK-NEXT: ret void
;
call void @streaming_body()
call void @nonstreaming_body()
ret void
}

define void @streaming_caller_multiple_streaming_callees() #0 "aarch64_pstate_sm_enabled" {
; CHECK-LABEL: define void @streaming_caller_multiple_streaming_callees
; CHECK-SAME: () #[[ATTR2]] {
; CHECK-NEXT: call void @streaming_body()
; CHECK-NEXT: call void @streaming_body()
define void @nonstreaming_caller_multiple_nonstreaming_callees() #0 {
; CHECK-LABEL: define void @nonstreaming_caller_multiple_nonstreaming_callees
; CHECK-SAME: () #[[ATTR1]] {
; CHECK-NEXT: call void @nonstreaming_body()
; CHECK-NEXT: call void @nonstreaming_body()
; CHECK-NEXT: ret void
;
call void @streaming_body()
call void @streaming_body()
call void @nonstreaming_body()
call void @nonstreaming_body()
ret void
}

; Allow inlining, as inline it would not increase the number of streaming-mode changes.
define void @streaming_caller_single_streaming_callee_inline() #0 {
; CHECK-LABEL: define void @streaming_caller_single_streaming_callee_inline
; CHECK-SAME: () #[[ATTR1]] {
; CHECK-NEXT: call void @streaming_caller_single_streaming_callee()
define void @streaming_caller_to_nonstreaming_callee_with_single_nonstreaming_callee_inline() #0 "aarch64_pstate_sm_enabled" {
; CHECK-LABEL: define void @streaming_caller_to_nonstreaming_callee_with_single_nonstreaming_callee_inline
; CHECK-SAME: () #[[ATTR2]] {
; CHECK-NEXT: call void @nonstreaming_body()
; CHECK-NEXT: ret void
;
call void @streaming_caller_single_streaming_callee()
call void @nonstreaming_caller_single_nonstreaming_callee()
ret void
}

; Prevent inlining, as inline it would lead to multiple streaming-mode changes.
define void @streaming_caller_multiple_streaming_callees_dont_inline() #0 {
; CHECK-LABEL: define void @streaming_caller_multiple_streaming_callees_dont_inline
; CHECK-SAME: () #[[ATTR1]] {
; CHECK-NEXT: call void @streaming_caller_multiple_streaming_callees()
; Prevent inlining, as inlining it would lead to multiple streaming-mode changes.
define void @streaming_caller_to_nonstreaming_callee_with_multiple_nonstreaming_callees_dont_inline() #0 "aarch64_pstate_sm_enabled" {
; CHECK-LABEL: define void @streaming_caller_to_nonstreaming_callee_with_multiple_nonstreaming_callees_dont_inline
; CHECK-SAME: () #[[ATTR2]] {
; CHECK-NEXT: call void @streaming_caller_to_nonstreaming_callee_with_multiple_nonstreaming_callees_dont_inline()
; CHECK-NEXT: ret void
;
call void @streaming_caller_multiple_streaming_callees()
call void @streaming_caller_to_nonstreaming_callee_with_multiple_nonstreaming_callees_dont_inline()
ret void
}

declare void @streaming_compatible_body() "aarch64_pstate_sm_compatible"

define void @streaming_caller_single_streaming_compatible_callee() #0 "aarch64_pstate_sm_enabled" {
; CHECK-LABEL: define void @streaming_caller_single_streaming_compatible_callee
; CHECK-SAME: () #[[ATTR2]] {
define void @nonstreaming_caller_single_streaming_compatible_callee() #0 {
; CHECK-LABEL: define void @nonstreaming_caller_single_streaming_compatible_callee
; CHECK-SAME: () #[[ATTR1]] {
; CHECK-NEXT: call void @streaming_compatible_body()
; CHECK-NEXT: ret void
;
call void @streaming_compatible_body()
ret void
}

define void @streaming_caller_multiple_streaming_compatible_callees() #0 "aarch64_pstate_sm_enabled" {
; CHECK-LABEL: define void @streaming_caller_multiple_streaming_compatible_callees
; CHECK-SAME: () #[[ATTR2]] {
define void @nonstreaming_caller_multiple_streaming_compatible_callees() #0 {
; CHECK-LABEL: define void @nonstreaming_caller_multiple_streaming_compatible_callees
; CHECK-SAME: () #[[ATTR1]] {
; CHECK-NEXT: call void @streaming_compatible_body()
; CHECK-NEXT: call void @streaming_compatible_body()
; CHECK-NEXT: ret void
Expand All @@ -654,24 +654,25 @@ define void @streaming_caller_multiple_streaming_compatible_callees() #0 "aarch
}

; Allow inlining, as inline would remove a streaming-mode change.
define void @streaming_caller_single_streaming_compatible_callee_inline() #0 {
; CHECK-LABEL: define void @streaming_caller_single_streaming_compatible_callee_inline
; CHECK-SAME: () #[[ATTR1]] {
; CHECK-NEXT: call void @streaming_caller_single_streaming_compatible_callee()
define void @streaming_caller_to_nonstreaming_callee_with_single_streamingcompatible_callee_inline() #0 "aarch64_pstate_sm_enabled" {
; CHECK-LABEL: define void @streaming_caller_to_nonstreaming_callee_with_single_streamingcompatible_callee_inline
; CHECK-SAME: () #[[ATTR2]] {
; CHECK-NEXT: call void @streaming_compatible_body()
; CHECK-NEXT: ret void
;
call void @streaming_caller_single_streaming_compatible_callee()
call void @nonstreaming_caller_single_streaming_compatible_callee()
ret void
}

; Allow inlining, as inline would remove several stremaing-mode changes.
define void @streaming_caller_multiple_streaming_compatible_callees_inline() #0 {
; CHECK-LABEL: define void @streaming_caller_multiple_streaming_compatible_callees_inline
; CHECK-SAME: () #[[ATTR1]] {
; CHECK-NEXT: call void @streaming_caller_multiple_streaming_compatible_callees()
; Allow inlining, as inline would remove several streaming-mode changes.
define void @streaming_caller_to_nonstreaming_callee_with_multiple_streamingcompatible_callees_inline() #0 "aarch64_pstate_sm_enabled" {
; CHECK-LABEL: define void @streaming_caller_to_nonstreaming_callee_with_multiple_streamingcompatible_callees_inline
; CHECK-SAME: () #[[ATTR2]] {
; CHECK-NEXT: call void @streaming_compatible_body()
; CHECK-NEXT: call void @streaming_compatible_body()
; CHECK-NEXT: ret void
;
call void @streaming_caller_multiple_streaming_compatible_callees()
call void @nonstreaming_caller_multiple_streaming_compatible_callees()
ret void
}

Expand Down