Skip to content

Commit 10ce9c0

Browse files
committed
Check prefix
1 parent f4ad3ac commit 10ce9c0

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

llvm/lib/Target/AArch64/Utils/AArch64SMEAttributes.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,7 @@
1414

1515
using namespace llvm;
1616

17-
void SMEAttrs::set(unsigned M, bool Enable) {
18-
if (Enable)
19-
Bitmask |= M;
20-
else
21-
Bitmask &= ~M;
22-
17+
void SMEAttrs::validate() const {
2318
// Streaming Mode Attrs
2419
assert(!(hasStreamingInterface() && hasStreamingCompatibleInterface()) &&
2520
"SM_Enabled and SM_Compatible are mutually exclusive");
@@ -81,6 +76,10 @@ SMEAttrs::SMEAttrs(const AttributeList &Attrs) {
8176

8277
void SMEAttrs::addKnownFunctionAttrs(StringRef FuncName,
8378
const TargetLowering &TLI) {
79+
// If the function name does not start with a _ or #_ is not a builtin.
80+
if (!FuncName.starts_with('_') && !FuncName.starts_with("#_"))
81+
return;
82+
8483
struct SMERoutineAttr {
8584
RTLIB::Libcall LC{RTLIB::UNKNOWN_LIBCALL};
8685
unsigned Attrs{SMEAttrs::Normal};

llvm/lib/Target/AArch64/Utils/AArch64SMEAttributes.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,15 @@ class SMEAttrs {
6262
addKnownFunctionAttrs(FuncName, TLI);
6363
};
6464

65-
void set(unsigned M, bool Enable = true);
65+
void set(unsigned M, bool Enable = true) {
66+
if (Enable)
67+
Bitmask |= M;
68+
else
69+
Bitmask &= ~M;
70+
#ifndef NDEBUG
71+
validate();
72+
#endif
73+
}
6674

6775
// Interfaces to query PSTATE.SM
6876
bool hasStreamingBody() const { return Bitmask & SM_Body; }
@@ -149,6 +157,7 @@ class SMEAttrs {
149157

150158
private:
151159
void addKnownFunctionAttrs(StringRef FuncName, const TargetLowering &TLI);
160+
void validate() const;
152161
};
153162

154163
/// SMECallAttrs is a utility class to hold the SMEAttrs for a callsite. It has

0 commit comments

Comments
 (0)