File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed
llvm/lib/Target/AArch64/Utils Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -113,10 +113,8 @@ bool SMECallAttrs::requiresSMChange() const {
113113SMECallAttrs::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.
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ namespace llvm {
1616class Function ;
1717class CallBase ;
1818class 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-
145148private:
146149 void addKnownFunctionAttrs (StringRef FuncName);
147150};
You can’t perform that action at this time.
0 commit comments