[clang] [clang][DebugInfo] Add inlined subprogram metadata for compiler built-ins (PR #189969)

Shivam Kunwar via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 2 02:37:40 PDT 2026


================
@@ -2648,6 +2648,11 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
   assert(!getContext().BuiltinInfo.isImmediate(BuiltinID) &&
          "Should not codegen for consteval builtins");
 
+  // Treat built-in as call to artificial inlined function in debug info.
+  // This enables e.g. profiling tools to annotate time spent in user-called
+  // built-ins with the built-in function name.
+  ApplyBuiltinDebugLocation DebugScope(*this, GD);
----------------
phyBrackets wrote:

I wonder if there is a way to scope this to built-in that actually expand to calls? Or at least skipping buit-ins that lower to single intrinsic with no side effects

https://github.com/llvm/llvm-project/pull/189969


More information about the cfe-commits mailing list