aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/PrologEpilogInserter.cpp
diff options
context:
space:
mode:
authorNick Desaulniers <ndesaulniers@google.com>2021-06-10 16:03:14 -0700
committerNick Desaulniers <ndesaulniers@google.com>2021-06-10 16:15:27 -0700
commitfc018ebb608ee0c1239b405460e49f1835ab6175 (patch)
tree65006b30f9612228e5508df56f7e48af457df81e /llvm/lib/CodeGen/PrologEpilogInserter.cpp
parent189428c8fc2465c25efbf4f0bb73e26fecf150ce (diff)
downloadllvm-fc018ebb608ee0c1239b405460e49f1835ab6175.zip
llvm-fc018ebb608ee0c1239b405460e49f1835ab6175.tar.gz
llvm-fc018ebb608ee0c1239b405460e49f1835ab6175.tar.bz2
[IR] make -warn-frame-size into a module attr
-Wframe-larger-than= is an interesting warning; we can't know the frame size until PrologueEpilogueInsertion (PEI); very late in the compilation pipeline. -Wframe-larger-than= was propagated through CC1 as an -mllvm flag, then was a cl::opt in LLVM's PEI pass; this meant it was dropped during LTO and needed to be re-specified via -plugin-opt. Instead, make it part of the IR proper as a module level attribute, similar to D103048. Introduce -fwarn-stack-size CC1 option. Reviewed By: rsmith, qcolombet Differential Revision: https://reviews.llvm.org/D103928
Diffstat (limited to 'llvm/lib/CodeGen/PrologEpilogInserter.cpp')
-rw-r--r--llvm/lib/CodeGen/PrologEpilogInserter.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
index ca57248..e09face1 100644
--- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp
+++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
@@ -138,11 +138,6 @@ char PEI::ID = 0;
char &llvm::PrologEpilogCodeInserterID = PEI::ID;
-static cl::opt<unsigned>
-WarnStackSize("warn-stack-size", cl::Hidden, cl::init((unsigned)-1),
- cl::desc("Warn for stack size bigger than the given"
- " number"));
-
INITIALIZE_PASS_BEGIN(PEI, DEBUG_TYPE, "Prologue/Epilogue Insertion", false,
false)
INITIALIZE_PASS_DEPENDENCY(MachineLoopInfo)
@@ -278,7 +273,9 @@ bool PEI::runOnMachineFunction(MachineFunction &MF) {
// Warn on stack size when we exceeds the given limit.
MachineFrameInfo &MFI = MF.getFrameInfo();
uint64_t StackSize = MFI.getStackSize();
- if (WarnStackSize.getNumOccurrences() > 0 && WarnStackSize < StackSize) {
+
+ unsigned Threshold = MF.getFunction().getParent()->getWarnStackSize();
+ if (StackSize > Threshold) {
DiagnosticInfoStackSize DiagStackSize(F, StackSize);
F.getContext().diagnose(DiagStackSize);
}