aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authorBenjamin Maxwell <benjamin.maxwell@arm.com>2025-10-24 16:44:35 +0100
committerGitHub <noreply@github.com>2025-10-24 15:44:35 +0000
commit22f29d61e50593c46945f100c9ca11fb9c5cca1b (patch)
tree9964ae0da588dcbaddaa37635ac86749bc8ad63a /llvm/lib
parent30984358ff94f3f71f4ac50ea58f6ab32ccc7c23 (diff)
downloadllvm-22f29d61e50593c46945f100c9ca11fb9c5cca1b.zip
llvm-22f29d61e50593c46945f100c9ca11fb9c5cca1b.tar.gz
llvm-22f29d61e50593c46945f100c9ca11fb9c5cca1b.tar.bz2
[AArch64][SME] Fix incorrect "attributes at callsite do not match" assert (#164991)
Clang always duplicates SME attributes to each callsite, which means removing "ZA_State_Agnostic" from CalledFn before the assert resulted in the assertion failing for IR emitted by clang. I've updated the existing test to match the form emitted by clang (which previously hit the assert).
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/AArch64/Utils/AArch64SMEAttributes.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/Target/AArch64/Utils/AArch64SMEAttributes.cpp b/llvm/lib/Target/AArch64/Utils/AArch64SMEAttributes.cpp
index 92e09ee..085c8588 100644
--- a/llvm/lib/Target/AArch64/Utils/AArch64SMEAttributes.cpp
+++ b/llvm/lib/Target/AArch64/Utils/AArch64SMEAttributes.cpp
@@ -131,15 +131,15 @@ SMECallAttrs::SMECallAttrs(const CallBase &CB,
if (auto *CalledFunction = CB.getCalledFunction())
CalledFn = SMEAttrs(*CalledFunction, RTLCI);
- // An `invoke` of an agnostic ZA function may not return normally (it may
- // resume in an exception block). In this case, it acts like a private ZA
- // callee and may require a ZA save to be set up before it is called.
- if (isa<InvokeInst>(CB))
- CalledFn.set(SMEAttrs::ZA_State_Agnostic, /*Enable=*/false);
-
// FIXME: We probably should not allow SME attributes on direct calls but
// clang duplicates streaming mode attributes at each callsite.
assert((IsIndirect ||
((Callsite.withoutPerCallsiteFlags() | CalledFn) == CalledFn)) &&
"SME attributes at callsite do not match declaration");
+
+ // An `invoke` of an agnostic ZA function may not return normally (it may
+ // resume in an exception block). In this case, it acts like a private ZA
+ // callee and may require a ZA save to be set up before it is called.
+ if (isa<InvokeInst>(CB))
+ CalledFn.set(SMEAttrs::ZA_State_Agnostic, /*Enable=*/false);
}