-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[Clang][Driver][SamplePGO] Enable -fsample-profile-use-profi by default #146795
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Driver change looks reasonable if samplepgo maintainers decide to proceed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, please give downstream users ~1w to add the opt out flag to build configs before landing this.
CC @llvm/pr-subscribers-pgo for visibility.
|
@llvm/pr-subscribers-pgo @llvm/pr-subscribers-clang Author: Nilanjana Basu (nilanjana87) ChangesSince profile inference improves sample coverage, it can be turned on by default. Ref. to part1 of this patch: #145957 Full diff: https://github.com/llvm/llvm-project/pull/146795.diff 2 Files Affected:
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 42323b2fe63bc..96ea7e9a849cc 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6282,7 +6282,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (getLastProfileSampleUseArg(Args) &&
Args.hasFlag(options::OPT_fsample_profile_use_profi,
- options::OPT_fno_sample_profile_use_profi, false)) {
+ options::OPT_fno_sample_profile_use_profi, true)) {
CmdArgs.push_back("-mllvm");
CmdArgs.push_back("-sample-profile-use-profi");
}
diff --git a/clang/test/Driver/pgo-sample-use-profi.c b/clang/test/Driver/pgo-sample-use-profi.c
index a8c8e81f96dcb..a695cb16a2564 100644
--- a/clang/test/Driver/pgo-sample-use-profi.c
+++ b/clang/test/Driver/pgo-sample-use-profi.c
@@ -1,12 +1,12 @@
/// Test if profi flag is enabled/disabled correctly based on user-specified configuration.
-/// Ensure that profi flag is disabled by default
+/// Ensure that profi flag is enabled by default
// Target specific checks:
-// RUN: %clang --target=x86_64 -c -fprofile-sample-use=/dev/null -### %s 2>&1 | FileCheck %s --check-prefixes=CHECK-NO-PROFI
-// RUN: %clang --target=AArch64 -c -fprofile-sample-use=/dev/null -### %s 2>&1 | FileCheck %s --check-prefixes=CHECK-NO-PROFI
+// RUN: %clang --target=x86_64 -c -fprofile-sample-use=/dev/null -### %s 2>&1 | FileCheck %s
+// RUN: %clang --target=AArch64 -c -fprofile-sample-use=/dev/null -### %s 2>&1 | FileCheck %s
// Target agnostic checks:
-// RUN: %clang -c -fprofile-sample-use=/dev/null -### %s 2>&1 | FileCheck %s --check-prefixes=CHECK-NO-PROFI
+// RUN: %clang -c -fprofile-sample-use=/dev/null -### %s 2>&1 | FileCheck %s
// RUN: %clang -c -fsample-profile-use-profi -fprofile-sample-use=/dev/null -### %s 2>&1 | FileCheck %s
// RUN: %clang -c -fno-sample-profile-use-profi -fsample-profile-use-profi -fprofile-sample-use=/dev/null -### %s 2>&1 | FileCheck %s
|
|
@llvm/pr-subscribers-clang-driver Author: Nilanjana Basu (nilanjana87) ChangesSince profile inference improves sample coverage, it can be turned on by default. Ref. to part1 of this patch: #145957 Full diff: https://github.com/llvm/llvm-project/pull/146795.diff 2 Files Affected:
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 42323b2fe63bc..96ea7e9a849cc 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6282,7 +6282,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (getLastProfileSampleUseArg(Args) &&
Args.hasFlag(options::OPT_fsample_profile_use_profi,
- options::OPT_fno_sample_profile_use_profi, false)) {
+ options::OPT_fno_sample_profile_use_profi, true)) {
CmdArgs.push_back("-mllvm");
CmdArgs.push_back("-sample-profile-use-profi");
}
diff --git a/clang/test/Driver/pgo-sample-use-profi.c b/clang/test/Driver/pgo-sample-use-profi.c
index a8c8e81f96dcb..a695cb16a2564 100644
--- a/clang/test/Driver/pgo-sample-use-profi.c
+++ b/clang/test/Driver/pgo-sample-use-profi.c
@@ -1,12 +1,12 @@
/// Test if profi flag is enabled/disabled correctly based on user-specified configuration.
-/// Ensure that profi flag is disabled by default
+/// Ensure that profi flag is enabled by default
// Target specific checks:
-// RUN: %clang --target=x86_64 -c -fprofile-sample-use=/dev/null -### %s 2>&1 | FileCheck %s --check-prefixes=CHECK-NO-PROFI
-// RUN: %clang --target=AArch64 -c -fprofile-sample-use=/dev/null -### %s 2>&1 | FileCheck %s --check-prefixes=CHECK-NO-PROFI
+// RUN: %clang --target=x86_64 -c -fprofile-sample-use=/dev/null -### %s 2>&1 | FileCheck %s
+// RUN: %clang --target=AArch64 -c -fprofile-sample-use=/dev/null -### %s 2>&1 | FileCheck %s
// Target agnostic checks:
-// RUN: %clang -c -fprofile-sample-use=/dev/null -### %s 2>&1 | FileCheck %s --check-prefixes=CHECK-NO-PROFI
+// RUN: %clang -c -fprofile-sample-use=/dev/null -### %s 2>&1 | FileCheck %s
// RUN: %clang -c -fsample-profile-use-profi -fprofile-sample-use=/dev/null -### %s 2>&1 | FileCheck %s
// RUN: %clang -c -fno-sample-profile-use-profi -fsample-profile-use-profi -fprofile-sample-use=/dev/null -### %s 2>&1 | FileCheck %s
|
c28bdc7 to
3d2ca80
Compare
|
Heads up: I'll merge this patch tomorrow. Let me know if any of the downstream users need more time before this goes in.
|
Since profile inference improves sample coverage, it can be turned on by default.
Ref. to part1 of this patch: #145957
Discourse conversation: https://discourse.llvm.org/t/turn-on-fsample-profile-use-profi-by-default/86508/2