Skip to content

Commit 12f2929

Browse files
committed
Tidy
1 parent 0139a37 commit 12f2929

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,8 @@ bool SMECallAttrs::requiresSMChange() const {
113113
SMECallAttrs::SMECallAttrs(const CallBase &CB)
114114
: CallerFn(*CB.getFunction()), CalledFn(SMEAttrs::Normal),
115115
Callsite(CB.getAttributes()), IsIndirect(CB.isIndirectCall()) {
116-
if (auto *CalledFunction = CB.getCalledFunction()) {
117-
CalledFn = SMEAttrs(*CalledFunction);
118-
CalledFn.addKnownFunctionAttrs(CalledFunction->getName());
119-
}
116+
if (auto *CalledFunction = CB.getCalledFunction())
117+
CalledFn = SMEAttrs(*CalledFunction, SMEAttrs::InferAttrsFromName::Yes);
120118

121119
// FIXME: We probably should not allow SME attributes on direct calls but
122120
// clang duplicates streaming mode attributes at each callsite.

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ namespace llvm {
1616
class Function;
1717
class CallBase;
1818
class AttributeList;
19-
class SMECallAttrs;
2019

2120
/// SMEAttrs is a utility class to parse the SME ACLE attributes on functions.
2221
/// It helps determine a function's requirements for PSTATE.ZA and PSTATE.SM.
@@ -49,9 +48,15 @@ class SMEAttrs {
4948
Callsite_Flags = ZT0_Undef
5049
};
5150

51+
enum class InferAttrsFromName { No, Yes };
52+
5253
SMEAttrs() = default;
5354
SMEAttrs(unsigned Mask) { set(Mask); }
54-
SMEAttrs(const Function &F) : SMEAttrs(F.getAttributes()) {}
55+
SMEAttrs(const Function &F, InferAttrsFromName Infer = InferAttrsFromName::No)
56+
: SMEAttrs(F.getAttributes()) {
57+
if (Infer == InferAttrsFromName::Yes)
58+
addKnownFunctionAttrs(F.getName());
59+
}
5560
SMEAttrs(const AttributeList &L);
5661
SMEAttrs(StringRef FuncName) { addKnownFunctionAttrs(FuncName); };
5762

@@ -140,8 +145,6 @@ class SMEAttrs {
140145
return Bitmask == Other.Bitmask;
141146
}
142147

143-
friend SMECallAttrs;
144-
145148
private:
146149
void addKnownFunctionAttrs(StringRef FuncName);
147150
};

0 commit comments

Comments
 (0)