Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
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
7 changes: 7 additions & 0 deletions llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,13 @@ bool AArch64TTIImpl::areInlineCompatible(const Function *Caller,
const Function *Callee) const {
SMECallAttrs CallAttrs(*Caller, *Callee);

// Never inline a function explicitly marked as being streaming,
// into a non-streaming function. Assume it was marked as streaming
// for a reason.
if (CallAttrs.caller().hasNonStreamingInterfaceAndBody() &&
CallAttrs.callee().hasStreamingInterfaceOrBody())
return false;

// When inlining, we should consider the body of the function, not the
// interface.
if (CallAttrs.callee().hasStreamingBody()) {
Expand Down
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,25 +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_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
Loading