diff options
author | Paul Kirth <paulkirth@google.com> | 2022-04-19 16:34:23 +0000 |
---|---|---|
committer | Paul Kirth <paulkirth@google.com> | 2022-04-20 18:29:40 +0000 |
commit | 61e36e87df1a4ad11f752d66c90e124101fe4023 (patch) | |
tree | dea1d2f021d07819b05d67764c3f1949467f3376 /llvm/lib/CodeGen/PrologEpilogInserter.cpp | |
parent | 340654e0f246cddb3fb6ebddb843ade9bfcff0a5 (diff) | |
download | llvm-61e36e87df1a4ad11f752d66c90e124101fe4023.zip llvm-61e36e87df1a4ad11f752d66c90e124101fe4023.tar.gz llvm-61e36e87df1a4ad11f752d66c90e124101fe4023.tar.bz2 |
[safestack] Support safestack in stack size diagnostics
Current stack size diagnostics ignore the size of the unsafe stack.
This patch attaches the size of the static portion of the unsafe stack
to the function as metadata, which can be used by the backend to emit
diagnostics regarding stack usage.
Reviewed By: phosek, mcgrathr
Differential Revision: https://reviews.llvm.org/D119996
Diffstat (limited to 'llvm/lib/CodeGen/PrologEpilogInserter.cpp')
-rw-r--r-- | llvm/lib/CodeGen/PrologEpilogInserter.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp index ee22cbd..bc45450 100644 --- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp +++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp @@ -283,6 +283,9 @@ bool PEI::runOnMachineFunction(MachineFunction &MF) { assert(!Failed && "Invalid warn-stack-size fn attr value"); (void)Failed; } + if (MF.getFunction().hasFnAttribute(Attribute::SafeStack)) { + StackSize += MFI.getUnsafeStackSize(); + } if (StackSize > Threshold) { DiagnosticInfoStackSize DiagStackSize(F, StackSize, Threshold, DS_Warning); F.getContext().diagnose(DiagStackSize); |