================
@@ -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);
----------------
jryans wrote:

Hmm, do you have a particular example in mind? Even single intrinsics can lead 
to a wide variety of behaviours further down the pipeline, depending on their 
purpose.

I believe it will be hard to "automatically" scope this to only certain 
built-ins based on their ultimate behaviour at this front-end emission stage 
because those behaviours are determined by other passes further down the 
pipeline and this Clang code gen stage is unaware of them. 

If we do decide to apply this to only some built-ins, perhaps the simplest way 
to do so at this point in the pipeline would be via an explicit list of 
built-ins that we do not want to apply this to (based on what we assume about 
how they behave).

Anyway, it may help to talk through one or more examples, so I am curious which 
you have in mind.

https://github.com/llvm/llvm-project/pull/189969
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to