Skip to content

Commit c7eede5

Browse files
authored
[clang][deps] Remove pgo profile flags from modules (llvm#87724)
These are not necessary when not performing codegen.
1 parent 0cd0aa0 commit c7eede5

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ makeCommonInvocationForModuleBuild(CompilerInvocation CI) {
175175
CI.getCodeGenOpts().CoverageCompilationDir.clear();
176176
CI.getCodeGenOpts().CoverageDataFile.clear();
177177
CI.getCodeGenOpts().CoverageNotesFile.clear();
178+
CI.getCodeGenOpts().ProfileInstrumentUsePath.clear();
179+
CI.getCodeGenOpts().SampleProfileFile.clear();
180+
CI.getCodeGenOpts().ProfileRemappingFile.clear();
178181
}
179182

180183
// Map output paths that affect behaviour to "-" so their existence is in the
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[
22
{
33
"directory": "DIR",
4-
"command": "clang -fsyntax-only DIR/tu.c -fmodules -fimplicit-module-maps -fmodules-validate-once-per-build-session -fbuild-session-file=DIR/build-session -fmodules-prune-interval=123 -fmodules-prune-after=123 -fmodules-cache-path=DIR/cache -include DIR/header.h -grecord-command-line -fdebug-compilation-dir=DIR/debug -fcoverage-compilation-dir=DIR/coverage -ftest-coverage -o DIR/tu.o -serialize-diagnostics DIR/tu.diag -MT tu -MD -MF DIR/tu.d",
4+
"command": "clang -fsyntax-only DIR/tu.c -fmodules -fimplicit-module-maps -fmodules-validate-once-per-build-session -fbuild-session-file=DIR/build-session -fmodules-prune-interval=123 -fmodules-prune-after=123 -fmodules-cache-path=DIR/cache -include DIR/header.h -grecord-command-line -fdebug-compilation-dir=DIR/debug -fcoverage-compilation-dir=DIR/coverage -ftest-coverage -fprofile-instr-use=DIR/tu.profdata -o DIR/tu.o -serialize-diagnostics DIR/tu.diag -MT tu -MD -MF DIR/tu.d",
55
"file": "DIR/tu.c"
66
}
77
]

clang/test/ClangScanDeps/removed-args.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
// RUN: rm -rf %t && mkdir %t
1010
// RUN: cp %S/Inputs/removed-args/* %t
1111
// RUN: touch %t/build-session
12+
// RUN: touch %t/tu.proftext
13+
// RUN: llvm-profdata merge %t/tu.proftext -o %t/tu.profdata
1214

1315
// RUN: sed "s|DIR|%/t|g" %S/Inputs/removed-args/cdb.json.template > %t/cdb.json
1416
// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full > %t/result.json
@@ -25,6 +27,7 @@
2527
// CHECK-NOT: "-fcoverage-compilation-dir="
2628
// CHECK-NOT: "-coverage-notes-file
2729
// CHECK-NOT: "-coverage-data-file
30+
// CHECK-NOT: "-fprofile-instrument-use-path
2831
// CHECK-NOT: "-dwarf-debug-flags"
2932
// CHECK-NOT: "-main-file-name"
3033
// CHECK-NOT: "-include"
@@ -50,6 +53,7 @@
5053
// CHECK-NOT: "-fcoverage-compilation-dir=
5154
// CHECK-NOT: "-coverage-notes-file
5255
// CHECK-NOT: "-coverage-data-file
56+
// CHECK-NOT: "-fprofile-instrument-use-path
5357
// CHECK-NOT: "-dwarf-debug-flags"
5458
// CHECK-NOT: "-main-file-name"
5559
// CHECK-NOT: "-include"

0 commit comments

Comments
 (0)