[clang] [clang][SME] Ignore flatten/clang::always_inline statements for callees with mismatched streaming attributes (PR #116391)
Benjamin Maxwell via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 26 05:57:57 PST 2024
================
@@ -1143,30 +1146,63 @@ void AArch64TargetCodeGenInfo::checkFunctionABI(
}
}
-void AArch64TargetCodeGenInfo::checkFunctionCallABIStreaming(
- CodeGenModule &CGM, SourceLocation CallLoc, const FunctionDecl *Caller,
- const FunctionDecl *Callee) const {
- if (!Caller || !Callee || !Callee->hasAttr<AlwaysInlineAttr>())
- return;
+enum class ArmSMEInlinability : uint8_t {
+ Ok = 0,
+ MismatchedStreamingCompatibility = 1 << 0,
+ IncompatibleStreamingModes = 1 << 1,
+ CalleeRequiresNewZA = 1 << 2,
+ LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/CalleeRequiresNewZA),
+};
+/// Determines if there are any Arm SME ABI issues with inlining \p Callee into
+/// \p Caller. Returns the issues in the ArmSMEInlinability bit enum (multiple
+/// bits can be set).
+static ArmSMEInlinability GetArmSMEInlinability(const FunctionDecl *Caller,
+ const FunctionDecl *Callee) {
bool CallerIsStreaming =
IsArmStreamingFunction(Caller, /*IncludeLocallyStreaming=*/true);
bool CalleeIsStreaming =
IsArmStreamingFunction(Callee, /*IncludeLocallyStreaming=*/true);
bool CallerIsStreamingCompatible = isStreamingCompatible(Caller);
bool CalleeIsStreamingCompatible = isStreamingCompatible(Callee);
+ ArmSMEInlinability Inlinability = ArmSMEInlinability::Ok;
+
if (!CalleeIsStreamingCompatible &&
- (CallerIsStreaming != CalleeIsStreaming || CallerIsStreamingCompatible))
- CGM.getDiags().Report(
- CallLoc, CalleeIsStreaming
- ? diag::err_function_always_inline_attribute_mismatch
- : diag::warn_function_always_inline_attribute_mismatch)
- << Caller->getDeclName() << Callee->getDeclName() << "streaming";
+ (CallerIsStreaming != CalleeIsStreaming || CallerIsStreamingCompatible)) {
+ Inlinability |= ArmSMEInlinability::MismatchedStreamingCompatibility;
+ if (CalleeIsStreaming)
+ Inlinability |= ArmSMEInlinability::IncompatibleStreamingModes;
+ }
----------------
MacDue wrote:
Done :+1:
https://github.com/llvm/llvm-project/pull/116391
More information about the cfe-commits
mailing list