diff options
| author | Wolfgang Pieb <wolfgang_pieb@playstation.sony.com> | 2022-07-05 09:15:33 -0700 |
|---|---|---|
| committer | Wolfgang Pieb <wolfgang_pieb@playstation.sony.com> | 2022-08-18 11:56:24 -0700 |
| commit | 8564e2fea559c58fecab3c7c01acf498bbe7820a (patch) | |
| tree | d62e28eeb599d6b79b81064ac7b106784938f33d /clang/lib/CodeGen/CodeGenModule.cpp | |
| parent | a48ff6888825002285060d46a7ed0f5142576991 (diff) | |
[Inlining] Add a clang option to limit inlining of functions
Add the clang option -finline-max-stacksize=<N> to suppress inlining
of functions whose stack size exceeds the given value.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D131986
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 0921008e254c..639285540c0a 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -2372,6 +2372,9 @@ void CodeGenModule::SetFunctionAttributes(GlobalDecl GD, llvm::Function *F, if (getLangOpts().OpenMP && FD->hasAttr<OMPDeclareSimdDeclAttr>()) getOpenMPRuntime().emitDeclareSimdFunction(FD, F); + if (CodeGenOpts.InlineMaxStackSize != UINT_MAX) + F->addFnAttr("inline-max-stacksize", llvm::utostr(CodeGenOpts.InlineMaxStackSize)); + if (const auto *CB = FD->getAttr<CallbackAttr>()) { // Annotate the callback behavior as metadata: // - The callback callee (as argument number). |
