Skip to content

Commit fb07c2c

Browse files
author
git apple-llvm automerger
committed
Merge commit 'd4331344ac45' from llvm.org/main into next
2 parents c215451 + d433134 commit fb07c2c

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,6 +1725,8 @@ def fsample_profile_use_profi : Flag<["-"], "fsample-profile-use-profi">,
17251725
basic block counts to branch probabilities to fix them by extended
17261726
and re-engineered classic MCMF (min-cost max-flow) approach.}]>;
17271727
def fno_profile_sample_accurate : Flag<["-"], "fno-profile-sample-accurate">, Group<f_Group>;
1728+
def fno_sample_profile_use_profi : Flag<["-"], "fno-sample-profile-use-profi">,
1729+
Group<f_Group>;
17281730
def fno_auto_profile : Flag<["-"], "fno-auto-profile">, Group<f_Group>,
17291731
Alias<fno_profile_sample_use>;
17301732
def fauto_profile_EQ : Joined<["-"], "fauto-profile=">,

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6451,7 +6451,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &Job,
64516451
Args.AddLastArg(CmdArgs, options::OPT_fclang_abi_compat_EQ);
64526452

64536453
if (getLastProfileSampleUseArg(Args) &&
6454-
Args.hasArg(options::OPT_fsample_profile_use_profi)) {
6454+
Args.hasFlag(options::OPT_fsample_profile_use_profi,
6455+
options::OPT_fno_sample_profile_use_profi, false)) {
64556456
CmdArgs.push_back("-mllvm");
64566457
CmdArgs.push_back("-sample-profile-use-profi");
64576458
}
Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
/// Test if profi flat is enabled in frontend as user-facing feature.
2-
// RUN: %clang --target=x86_64 -c -fsample-profile-use-profi -fprofile-sample-use=/dev/null -### %s 2>&1 | FileCheck %s
1+
/// Test if profi flag is enabled/disabled correctly based on user-specified configuration.
2+
/// Ensure that profi flag is disabled by default
3+
4+
// Target specific checks:
5+
// RUN: %clang --target=x86_64 -c -fprofile-sample-use=/dev/null -### %s 2>&1 | FileCheck %s --check-prefixes=CHECK-NO-PROFI
6+
// RUN: %clang --target=AArch64 -c -fprofile-sample-use=/dev/null -### %s 2>&1 | FileCheck %s --check-prefixes=CHECK-NO-PROFI
7+
8+
// Target agnostic checks:
9+
// RUN: %clang -c -fprofile-sample-use=/dev/null -### %s 2>&1 | FileCheck %s --check-prefixes=CHECK-NO-PROFI
10+
// RUN: %clang -c -fsample-profile-use-profi -fprofile-sample-use=/dev/null -### %s 2>&1 | FileCheck %s
11+
// RUN: %clang -c -fno-sample-profile-use-profi -fsample-profile-use-profi -fprofile-sample-use=/dev/null -### %s 2>&1 | FileCheck %s
12+
13+
// Cases where profi flag is explicitly disabled:
14+
// RUN: %clang -c -### %s 2>&1 | FileCheck %s --check-prefixes=CHECK-NO-PROFI
15+
// RUN: %clang -c -fno-sample-profile-use-profi -fprofile-sample-use=/dev/null -### %s 2>&1 | FileCheck %s --check-prefixes=CHECK-NO-PROFI
16+
// RUN: %clang -c -fsample-profile-use-profi -fno-sample-profile-use-profi -fprofile-sample-use=/dev/null -### %s 2>&1 | FileCheck %s --check-prefixes=CHECK-NO-PROFI
17+
318

419
// CHECK: "-mllvm" "-sample-profile-use-profi"
20+
// CHECK-NO-PROFI-NOT: "-sample-profile-use-profi"

0 commit comments

Comments
 (0)