llvm-project/llvm/test/Transforms/Inline/SystemZ/inline-target-attr.ll
Nikita Popov 18e4f775c3
[SystemZ] Remove incorrect areInlineCompatible hook (#152494)
This reverts https://github.com/llvm/llvm-project/pull/132976.

The PR incorrectly claimed that this makes inlining more liberal,
referencing the string comparison in TargetTransformInfoImpl.h.

However, the implementation that actually applies is the one in
BasicTTIImpl.h, which performs a feature subset comparison. As such,
this regressed inlining, most concerningly of functions without +vector
into functions with +vector.

Revert the change to restore the previous behavior.
2025-08-08 10:06:19 +02:00

43 lines
1.1 KiB
LLVM

; RUN: opt < %s -mtriple=s390x-linux-gnu -S -passes=inline | FileCheck %s
; RUN: opt < %s -mtriple=s390x-linux-gnu -S -passes='cgscc(inline)' | FileCheck %s
; Check that we only inline when we have equal target attributes.
define i32 @foo() #0 {
entry:
%call = call i32 (...) @baz()
ret i32 %call
; CHECK-LABEL: foo
; CHECK: call i32 (...) @baz()
}
declare i32 @baz(...) #0
define i32 @features_subset() #1 {
entry:
%call = call i32 @foo()
ret i32 %call
; CHECK-LABEL: features_subset
; CHECK: call i32 (...) @baz()
}
define i32 @features_equal() #0 {
entry:
%call = call i32 @foo()
ret i32 %call
; CHECK-LABEL: features_equal
; CHECK: call i32 (...) @baz()
}
define i32 @features_different() #2 {
entry:
%call = call i32 @foo()
ret i32 %call
; CHECK-LABEL: features_different
; CHECK: call i32 @foo()
}
attributes #0 = { "target-cpu"="generic" "target-features"="+guarded-storage" }
attributes #1 = { "target-cpu"="generic" "target-features"="+guarded-storage,+enhanced-sort" }
attributes #2 = { "target-cpu"="generic" "target-features"="+concurrent-functions" }