Skip to content

Commit 22417ec

Browse files
authored
[Driver] Do not add gno-column-info when using sampling PGO (#117954)
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.
1 parent f7ef072 commit 22417ec

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4690,15 +4690,15 @@ renderDebugOptions(const ToolChain &TC, const Driver &D, const llvm::Triple &T,
46904690
Args.ClaimAllArgs(options::OPT_g_flags_Group);
46914691

46924692
// Column info is included by default for everything except SCE and
4693-
// CodeView. Clang doesn't track end columns, just starting columns, which,
4694-
// in theory, is fine for CodeView (and PDB). In practice, however, the
4695-
// Microsoft debuggers don't handle missing end columns well, and the AIX
4696-
// debugger DBX also doesn't handle the columns well, so it's better not to
4697-
// include any column info.
4693+
// CodeView if not use sampling PGO. Clang doesn't track end columns, just
4694+
// starting columns, which, in theory, is fine for CodeView (and PDB). In
4695+
// practice, however, the Microsoft debuggers don't handle missing end columns
4696+
// well, and the AIX debugger DBX also doesn't handle the columns well, so
4697+
// it's better not to include any column info.
46984698
if (const Arg *A = Args.getLastArg(options::OPT_gcolumn_info))
46994699
(void)checkDebugInfoOption(A, Args, D, TC);
47004700
if (!Args.hasFlag(options::OPT_gcolumn_info, options::OPT_gno_column_info,
4701-
!EmitCodeView &&
4701+
!(EmitCodeView && !getLastProfileSampleUseArg(Args)) &&
47024702
(DebuggerTuning != llvm::DebuggerKind::SCE &&
47034703
DebuggerTuning != llvm::DebuggerKind::DBX)))
47044704
CmdArgs.push_back("-gno-column-info");

clang/test/Driver/codeview-column-info.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
// CHECK: "-gno-column-info"
1515

1616
// RUN: %clang_cl -### /Z7 -gcolumn-info -- %s 2>&1 | FileCheck --check-prefix=COLUMN %s
17+
// RUN: %clang_cl -### --target=x86_64-windows-msvc /Z7 -fprofile-sample-use=%S/Inputs/file.prof -- %s 2>&1 | FileCheck --check-prefix=COLUMN %s
1718

1819
// COLUMN-NOT: "-gno-column-info"

0 commit comments

Comments
 (0)