[PATCH] D157826: [X86] Allow inlining callees missing VLX feature
Kal Conley via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 13 14:13:59 PDT 2023
kalcutter created this revision.
kalcutter added reviewers: kazu, RKSimon, pengfei.
Herald added a subscriber: hiraditya.
Herald added a project: All.
kalcutter requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This patch attempts to fix a regression caused by https://github.com/llvm/llvm-project/commit/d6f994acb3d545b80161e24ab742c9c69d4bbf33. In particular, always_inline should work on callees without VLX from VLX functions. I found this testing clang-17-rc2. If accepted, please also apply this to the LLVM 17.0.0 branch.
https://reviews.llvm.org/D157826
Files:
llvm/lib/Target/X86/X86TargetTransformInfo.cpp
llvm/test/Transforms/Inline/X86/call-abi-compatibility.ll
Index: llvm/test/Transforms/Inline/X86/call-abi-compatibility.ll
===================================================================
--- llvm/test/Transforms/Inline/X86/call-abi-compatibility.ll
+++ llvm/test/Transforms/Inline/X86/call-abi-compatibility.ll
@@ -93,3 +93,21 @@
}
declare i64 @caller_unknown_simple(i64)
+
+; This call should get inlined, because the callee is only missing VLX.
+define void @caller_vlx() "target-features"="+avx512f,+avx512vl" {
+; CHECK-LABEL: define {{[^@]+}}@caller_vlx
+; CHECK-SAME: () #[[ATTR2:[0-9]+]] {
+; CHECK-NEXT: call void @callee_not_vlx(<8 x i64> <i64 0, i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7>)
+; CHECK-NEXT: ret void
+;
+ call void @caller_not_vlx(<8 x i64> <i64 0, i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7>)
+ ret void
+}
+
+define internal void @caller_not_vlx(<8 x i64> %arg) "target-features"="+avx512f" {
+ call void @callee_not_vlx(<8 x i64> %arg)
+ ret void
+}
+
+declare void @callee_not_vlx(<8 x i64>)
Index: llvm/lib/Target/X86/X86TargetTransformInfo.cpp
===================================================================
--- llvm/lib/Target/X86/X86TargetTransformInfo.cpp
+++ llvm/lib/Target/X86/X86TargetTransformInfo.cpp
@@ -6049,6 +6049,10 @@
if (RealCallerBits == RealCalleeBits)
return true;
+ // If the callee is only missing VLX, they are compatible.
+ if (RealCallerBits == (RealCalleeBits | FeatureBitset{X86::FeatureVLX}))
+ return true;
+
// If the features are a subset, we need to additionally check for calls
// that may become ABI-incompatible as a result of inlining.
if ((RealCallerBits & RealCalleeBits) != RealCalleeBits)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157826.549755.patch
Type: text/x-patch
Size: 1657 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230813/208975cb/attachment.bin>
More information about the llvm-commits
mailing list