Skip to content

Commit

Permalink
[Driver] Do not add gno-column-info when using sampling PGO (#117954)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
HaohaiWen authored Dec 1, 2024
1 parent f7ef072 commit 22417ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 6 additions & 6 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
1 change: 1 addition & 0 deletions clang/test/Driver/codeview-column-info.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 22417ec

Please sign in to comment.