[clang] [llvm] [clang/LLVM] Add flatten_deep attribute for depth-limited inlining (1/2) (PR #165777)
Yuxuan Chen via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 4 13:04:28 PST 2025
================
@@ -2749,6 +2749,15 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
B.addAttribute("aarch64_new_zt0");
}
+ // Handle flatten_deep attribute for depth-based inlining
+ if (const auto *FD = dyn_cast<FunctionDecl>(D)) {
+ if (const FlattenDeepAttr *FDA = FD->getAttr<FlattenDeepAttr>()) {
+ // Add the flatten_deep attribute with the max depth value as a typed int
+ // attribute
+ B.addRawIntAttr(llvm::Attribute::FlattenDeep, FDA->getMaxDepth());
----------------
yuxuanchen1997 wrote:
`addRawIntAttr` doesn't seem to be widely used outside of `llvm/IR/Attributes.cpp`. Can you not use `addFlattenDeepAttr`?
https://github.com/llvm/llvm-project/pull/165777
More information about the llvm-commits
mailing list