[llvm] [CodeGen] Add -force-emit-call-site-info LLVM flag (PR #206668)

Zhaoxuan Jiang via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 1 01:32:48 PDT 2026


================
@@ -293,7 +293,15 @@ class TargetOptions {
   /// The flag enables call site info production. It is used only for debug
   /// info, and it is restricted only to optimized code. This can be used for
   /// something else, so that should be controlled in the frontend.
+  /// This flag should never be checked directly, always use
+  /// \ref ShouldEmitCallSiteInfo instead.
   unsigned EmitCallSiteInfo : 1;
+  /// Returns true when call site info should be emitted. This combines
+  /// the frontend-controlled EmitCallSiteInfo flag with the
+  /// -force-emit-call-site-info LLVM option, which allows enabling call site
+  /// info production without requiring frontend source changes.
+  LLVM_ABI bool ShouldEmitCallSiteInfo() const;
----------------
nocchijiang wrote:

Thanks for the design suggestion. Say we add an `EmitCodeGenCallSiteInfo` bit to `TargetOptions` alongside `EmitCallSiteInfo`, so the AArch64 backend can flip it during `AArch64TargetMachine` initialization. The concern is that all AArch64 compilations would then pay the cost of populating `CallSiteInfo`, regardless of whether the outliner is actually enabled. I'm afraid that overhead may not be acceptable. The `cl::opt` LLVM flag I was about to add is basically prepared for outliner users exclusively: they know the benefits, they know this introduces overheads, albeit minor (to none because I think at least for Clang we enable `-g` most of the time for production builds).

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


More information about the llvm-commits mailing list