[clang] [Driver] Do not add gno-column-info when using sampling PGO (PR #117954)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 27 17:59:49 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-driver
Author: Haohai Wen (HaohaiWen)
<details>
<summary>Changes</summary>
Column info is important for sampling PGO to generate/load profile file.
On windows, it will be automatically added when using -gdwarf to generate
profile file. It should also be generated when fprofile-sample-use= is used.
---
Full diff: https://github.com/llvm/llvm-project/pull/117954.diff
2 Files Affected:
- (modified) clang/lib/Driver/ToolChains/Clang.cpp (+6-6)
- (modified) clang/test/Driver/codeview-column-info.c (+1)
``````````diff
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 217c1a845f0a47..b6d39a5186b794 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -4690,15 +4690,15 @@ renderDebugOptions(const ToolChain &TC, const Driver &D, const llvm::Triple &T,
Args.ClaimAllArgs(options::OPT_g_flags_Group);
// Column info is included by default for everything except SCE and
- // CodeView. Clang doesn't track end columns, just starting columns, which,
- // in theory, is fine for CodeView (and PDB). In practice, however, the
- // Microsoft debuggers don't handle missing end columns well, and the AIX
- // debugger DBX also doesn't handle the columns well, so it's better not to
- // include any column info.
+ // CodeView if not use sampling PGO. Clang doesn't track end columns, just
+ // starting columns, which, in theory, is fine for CodeView (and PDB). In
+ // practice, however, the Microsoft debuggers don't handle missing end columns
+ // well, and the AIX debugger DBX also doesn't handle the columns well, so
+ // it's better not to include any column info.
if (const Arg *A = Args.getLastArg(options::OPT_gcolumn_info))
(void)checkDebugInfoOption(A, Args, D, TC);
if (!Args.hasFlag(options::OPT_gcolumn_info, options::OPT_gno_column_info,
- !EmitCodeView &&
+ !(EmitCodeView && !getLastProfileSampleUseArg(Args)) &&
(DebuggerTuning != llvm::DebuggerKind::SCE &&
DebuggerTuning != llvm::DebuggerKind::DBX)))
CmdArgs.push_back("-gno-column-info");
diff --git a/clang/test/Driver/codeview-column-info.c b/clang/test/Driver/codeview-column-info.c
index 4cabefac06e648..99b1d1d9f94689 100644
--- a/clang/test/Driver/codeview-column-info.c
+++ b/clang/test/Driver/codeview-column-info.c
@@ -14,5 +14,6 @@
// CHECK: "-gno-column-info"
// RUN: %clang_cl -### /Z7 -gcolumn-info -- %s 2>&1 | FileCheck --check-prefix=COLUMN %s
+// RUN: %clang_cl -### --target=x86_64-windows-msvc /Z7 /fprofile-sample-use=%S/Inputs/file.prof -- %s 2>&1 | FileCheck --check-prefix=COLUMN %s
// COLUMN-NOT: "-gno-column-info"
``````````
</details>
https://github.com/llvm/llvm-project/pull/117954
More information about the cfe-commits
mailing list