[llvm] Fixed stack size estimates in the function for the -fstack-usage option (PR #173181)
Aleksandr Ryabikov via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 21 01:07:21 PST 2025
https://github.com/rsashka created https://github.com/llvm/llvm-project/pull/173181
Fix issue #173158
>From baa18363e4a33fd9cdf28504df3c2e13c675d2c1 Mon Sep 17 00:00:00 2001
From: Aleksandr Ryabikov <rsashka at mail.ru>
Date: Sun, 21 Dec 2025 11:56:03 +0300
Subject: [PATCH] Fixed stack size estimates in the function for the
-fstack-usage option
---
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 4d2992456f6f8..4a99d7de081f5 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -1679,8 +1679,10 @@ void AsmPrinter::emitStackUsage(const MachineFunction &MF) {
return;
const MachineFrameInfo &FrameInfo = MF.getFrameInfo();
+ // The estimated maximum stack size, including alignment and
+ // target-specific stack size, for function return addresses.
uint64_t StackSize =
- FrameInfo.getStackSize() + FrameInfo.getUnsafeStackSize();
+ FrameInfo.estimateStackSize(MF) + MF.getTarget().getAllocaPointerSize();
if (StackUsageStream == nullptr) {
std::error_code EC;
More information about the llvm-commits
mailing list