Skip to content

[Driver] Do not add gno-column-info when using sampling PGO #117954

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"