[llvm] [AArch64] Add Statistics for Probed Stacks (PR #155661)
Kyungwoo Lee via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 27 10:20:57 PDT 2025
https://github.com/kyulee-com created https://github.com/llvm/llvm-project/pull/155661
This change adds two new statistics to track the usage of probed stacks on AArch64.
>From a5cc6aec3c7eb8263f4e236189f3c9271cefc08d Mon Sep 17 00:00:00 2001
From: Kyungwoo Lee <kyulee at meta.com>
Date: Wed, 27 Aug 2025 10:17:48 -0700
Subject: [PATCH] [AArch64] Add Statistics for Probed Stacks
This change adds two new statistics to track the usage of probed stacks on AArch64.
---
llvm/lib/Target/AArch64/AArch64FrameLowering.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp b/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
index 7725fa4f1ccb1..2bee5667d9fac 100644
--- a/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
@@ -293,6 +293,8 @@ static cl::opt<bool> DisableMultiVectorSpillFill(
cl::desc("Disable use of LD/ST pairs for SME2 or SVE2p1"), cl::init(false),
cl::Hidden);
+STATISTIC(NumProbedStacksFixed, "Number of probed stacks fixed");
+STATISTIC(NumProbedStacksDynamic, "Number of probed stacks dynamic");
STATISTIC(NumRedZoneFunctions, "Number of functions using red zone");
/// Returns how much of the incoming argument stack area (in bytes) we should
@@ -5630,6 +5632,7 @@ void AArch64FrameLowering::inlineStackProbe(MachineFunction &MF,
MI->getOperand(3).getImm());
inlineStackProbeFixed(MI->getIterator(), ScratchReg, FrameSize,
CFAOffset);
+ ++NumProbedStacksFixed;
} else {
assert(MI->getOpcode() == AArch64::PROBED_STACKALLOC_VAR &&
"Stack probe pseudo-instruction expected");
@@ -5637,6 +5640,7 @@ void AArch64FrameLowering::inlineStackProbe(MachineFunction &MF,
MI->getMF()->getSubtarget<AArch64Subtarget>().getInstrInfo();
Register TargetReg = MI->getOperand(0).getReg();
(void)TII->probedStackAlloc(MI->getIterator(), TargetReg, true);
+ ++NumProbedStacksDynamic;
}
MI->eraseFromParent();
}
More information about the llvm-commits
mailing list