[IR] make -warn-frame-size into a module attr
authorNick Desaulniers <ndesaulniers@google.com>
Thu, 10 Jun 2021 23:03:14 +0000 (16:03 -0700)
committerNick Desaulniers <ndesaulniers@google.com>
Thu, 10 Jun 2021 23:15:27 +0000 (16:15 -0700)
commitfc018ebb608ee0c1239b405460e49f1835ab6175
tree65006b30f9612228e5508df56f7e48af457df81e
parent189428c8fc2465c25efbf4f0bb73e26fecf150ce
[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
13 files changed:
clang/include/clang/Basic/CodeGenOptions.def
clang/include/clang/Driver/Options.td
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/Wframe-larger-than.c [new file with mode: 0644]
clang/test/Frontend/backend-diagnostic.c
clang/test/Misc/backend-stack-frame-diagnostics-fallback.cpp
llvm/include/llvm/IR/Module.h
llvm/lib/CodeGen/PrologEpilogInserter.cpp
llvm/lib/IR/Module.cpp
llvm/test/CodeGen/ARM/warn-stack.ll
llvm/test/CodeGen/X86/warn-stack.ll
llvm/test/Linker/warn-stack-frame.ll [new file with mode: 0644]