[llvm] [AArch64] Cache repeated subtarget queries (NFC) (PR #222637)
Cullen Rhodes via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 11 02:03:10 PDT 2026
================
@@ -436,6 +439,12 @@ AArch64TargetMachine::~AArch64TargetMachine() = default;
const AArch64Subtarget *
AArch64TargetMachine::getSubtargetImpl(const Function &F) const {
+ // Constructing the subtarget key is not cheap, avoid rebuilding it for
+ // repeated queries with the same function attributes.
+ AttributeSet FnAttrs = F.getAttributes().getFnAttrs();
+ if (LastSubtarget && LastSubtargetAttrs == FnAttrs)
----------------
c-rhodes wrote:
I think those are the global options Ben was referring to. They are fixed per compiler invocation, so cannot change between subtarget queries.
https://github.com/llvm/llvm-project/pull/222637
More information about the llvm-commits
mailing list