================
@@ -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:
for example `__builtin_expect(x, 1)` emits no instructions at all, it just
passes through the value. And `__builtin_unreachable()` emits a single
`unreachable`. In both cases a synthetic subprogram gets created with nothing
meaningful to profile against.
And a short exclusion list of known zero-codegen built-ins like these might be
a simple middle ground, their behavior is well defined at the clang level so
there's no ambiguity about what to skip.
https://github.com/llvm/llvm-project/pull/189969
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits