[clang] [CIR] Add math and builtin intrinsics support (PR #175233)
Bruno Cardoso Lopes via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 13 15:54:59 PST 2026
================
@@ -2196,7 +2197,44 @@ void CIRGenModule::setCIRFunctionAttributesForDefinition(
} else if (codeGenOpts.getInlining() == CodeGenOptions::OnlyAlwaysInlining) {
// If inlining is disabled, force everything that isn't always_inline
// to carry an explicit noinline attribute.
+ // However, don't mark functions as noinline if they only contain
+ // builtin calls that will become intrinsics - these simple wrappers
+ // should be allowed to inline so the intrinsics can be optimized.
if (!isAlwaysInline) {
+ // Check if this function contains any builtin calls that will become
+ // intrinsics. If so, don't mark as noinline - let the optimizer handle
+ // it.
+ if (auto *fd = dyn_cast<FunctionDecl>(decl)) {
----------------
bcardosolopes wrote:
Instead of doing a visitor walk here, which can get expensive, did you try a CIRGenFunction state that is flipped to true everytime if finds a builtin?
https://github.com/llvm/llvm-project/pull/175233
More information about the cfe-commits
mailing list