Skip to content

Commit 10866a1

Browse files
committed
Revert "[misexpect] Re-implement MisExpect Diagnostics"
This reverts commit e7749d4.
1 parent e7749d4 commit 10866a1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2
-2037
lines changed

clang/docs/MisExpect.rst

Lines changed: 0 additions & 75 deletions
This file was deleted.

clang/docs/ReleaseNotes.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ Improvements to Clang's diagnostics
6868
constants that are not representable in a casted value. For example,
6969
``(float) f == 0.1`` is always false.
7070

71-
- ``-Wmisexpect`` warns when the branch weights collected during profiling
72-
conflict with those added by ``llvm.expect``.
73-
7471
Non-comprehensive list of changes in this release
7572
-------------------------------------------------
7673

clang/include/clang/Basic/CodeGenOptions.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ CODEGENOPT(NoExecStack , 1, 0) ///< Set when -Wa,--noexecstack is enabled.
175175
CODEGENOPT(FatalWarnings , 1, 0) ///< Set when -Wa,--fatal-warnings is
176176
///< enabled.
177177
CODEGENOPT(NoWarn , 1, 0) ///< Set when -Wa,--no-warn is enabled.
178-
CODEGENOPT(MisExpect , 1, 0) ///< Set when -Wmisexpect is enabled
179178
CODEGENOPT(EnableSegmentedStacks , 1, 0) ///< Set when -fsplit-stack is enabled.
180179
CODEGENOPT(NoInlineLineTables, 1, 0) ///< Whether debug info should contain
181180
///< inline line tables.

clang/include/clang/Basic/CodeGenOptions.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,6 @@ class CodeGenOptions : public CodeGenOptionsBase {
420420
/// If threshold option is not specified, it is disabled by default.
421421
Optional<uint64_t> DiagnosticsHotnessThreshold = 0;
422422

423-
/// The maximum percentage profiling weights can deviate from the expected
424-
/// values in order to be included in misexpect diagnostics.
425-
Optional<uint64_t> DiagnosticsMisExpectTolerance = 0;
426-
427423
public:
428424
// Define accessors/mutators for code generation options of enumeration type.
429425
#define CODEGENOPT(Name, Bits, Default)

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,6 @@ def err_drv_invalid_darwin_version : Error<
149149
"invalid Darwin version number: %0">;
150150
def err_drv_invalid_diagnotics_hotness_threshold : Error<
151151
"invalid argument in '%0', only integer or 'auto' is supported">;
152-
def err_drv_invalid_diagnotics_misexpect_tolerance : Error<
153-
"invalid argument in '%0', only integers are supported">;
154152
def err_drv_missing_argument : Error<
155153
"argument to '%0' is missing (expected %1 value%s1)">;
156154
def err_drv_invalid_Xarch_argument_with_args : Error<
@@ -376,9 +374,6 @@ def warn_drv_empty_joined_argument : Warning<
376374
def warn_drv_diagnostics_hotness_requires_pgo : Warning<
377375
"argument '%0' requires profile-guided optimization information">,
378376
InGroup<UnusedCommandLineArgument>;
379-
def warn_drv_diagnostics_misexpect_requires_pgo : Warning<
380-
"argument '%0' requires profile-guided optimization information">,
381-
InGroup<UnusedCommandLineArgument>;
382377
def warn_drv_clang_unsupported : Warning<
383378
"the clang compiler does not support '%0'">;
384379
def warn_drv_deprecated_arg : Warning<

clang/include/clang/Basic/DiagnosticFrontendKinds.td

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -311,11 +311,6 @@ def warn_profile_data_missing : Warning<
311311
def warn_profile_data_unprofiled : Warning<
312312
"no profile data available for file \"%0\"">,
313313
InGroup<ProfileInstrUnprofiled>;
314-
def warn_profile_data_misexpect : Warning<
315-
"Potential performance regression from use of __builtin_expect(): "
316-
"Annotation was correct on %0 of profiled executions.">,
317-
BackendInfo,
318-
InGroup<MisExpect>;
319314
} // end of instrumentation issue category
320315

321316
}

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1249,7 +1249,6 @@ def BackendWarningAttributes : DiagGroup<"attribute-warning">;
12491249
def ProfileInstrMissing : DiagGroup<"profile-instr-missing">;
12501250
def ProfileInstrOutOfDate : DiagGroup<"profile-instr-out-of-date">;
12511251
def ProfileInstrUnprofiled : DiagGroup<"profile-instr-unprofiled">;
1252-
def MisExpect : DiagGroup<"misexpect">;
12531252

12541253
// AddressSanitizer frontend instrumentation remarks.
12551254
def SanitizeAddressRemarks : DiagGroup<"sanitize-address">;

clang/include/clang/Driver/Options.td

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,9 +1424,6 @@ def fdiagnostics_hotness_threshold_EQ : Joined<["-"], "fdiagnostics-hotness-thre
14241424
Group<f_Group>, Flags<[CC1Option]>, MetaVarName<"<value>">,
14251425
HelpText<"Prevent optimization remarks from being output if they do not have at least this profile count. "
14261426
"Use 'auto' to apply the threshold from profile summary">;
1427-
def fdiagnostics_misexpect_tolerance_EQ : Joined<["-"], "fdiagnostics-misexpect-tolerance=">,
1428-
Group<f_Group>, Flags<[CC1Option]>, MetaVarName<"<value>">,
1429-
HelpText<"Prevent misexpect diagnostics from being output if the profile counts are within N% of the expected. ">;
14301427
defm diagnostics_show_option : BoolFOption<"diagnostics-show-option",
14311428
DiagnosticOpts<"ShowOptionNames">, DefaultTrue,
14321429
NegFlag<SetFalse, [CC1Option]>, PosFlag<SetTrue, [], "Print option name with mappable diagnostics">>;

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,6 @@ static bool initTargetOptions(DiagnosticsEngine &Diags,
650650
Entry.IgnoreSysRoot ? Entry.Path : HSOpts.Sysroot + Entry.Path);
651651
Options.MCOptions.Argv0 = CodeGenOpts.Argv0;
652652
Options.MCOptions.CommandLineArgs = CodeGenOpts.CommandLineArgs;
653-
Options.MisExpect = CodeGenOpts.MisExpect;
654653

655654
return true;
656655
}

clang/lib/CodeGen/CodeGenAction.cpp

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -340,15 +340,6 @@ namespace clang {
340340
CodeGenOpts.getProfileUse() != CodeGenOptions::ProfileNone)
341341
Ctx.setDiagnosticsHotnessRequested(true);
342342

343-
if (CodeGenOpts.MisExpect) {
344-
Ctx.setMisExpectWarningRequested(true);
345-
}
346-
347-
if (CodeGenOpts.DiagnosticsMisExpectTolerance) {
348-
Ctx.setDiagnosticsMisExpectTolerance(
349-
CodeGenOpts.DiagnosticsMisExpectTolerance);
350-
}
351-
352343
// Link each LinkModule into our module.
353344
if (LinkInModules())
354345
return;
@@ -449,9 +440,6 @@ namespace clang {
449440
void OptimizationFailureHandler(
450441
const llvm::DiagnosticInfoOptimizationFailure &D);
451442
void DontCallDiagHandler(const DiagnosticInfoDontCall &D);
452-
/// Specialized handler for misexpect warnings.
453-
/// Note that misexpect remarks are emitted through ORE
454-
void MisExpectDiagHandler(const llvm::DiagnosticInfoMisExpect &D);
455443
};
456444

457445
void BackendConsumer::anchor() {}
@@ -833,25 +821,6 @@ void BackendConsumer::DontCallDiagHandler(const DiagnosticInfoDontCall &D) {
833821
<< llvm::demangle(D.getFunctionName().str()) << D.getNote();
834822
}
835823

836-
void BackendConsumer::MisExpectDiagHandler(
837-
const llvm::DiagnosticInfoMisExpect &D) {
838-
StringRef Filename;
839-
unsigned Line, Column;
840-
bool BadDebugInfo = false;
841-
FullSourceLoc Loc =
842-
getBestLocationFromDebugLoc(D, BadDebugInfo, Filename, Line, Column);
843-
844-
Diags.Report(Loc, diag::warn_profile_data_misexpect) << D.getMsg().str();
845-
846-
if (BadDebugInfo)
847-
// If we were not able to translate the file:line:col information
848-
// back to a SourceLocation, at least emit a note stating that
849-
// we could not translate this location. This can happen in the
850-
// case of #line directives.
851-
Diags.Report(Loc, diag::note_fe_backend_invalid_loc)
852-
<< Filename << Line << Column;
853-
}
854-
855824
/// This function is invoked when the backend needs
856825
/// to report something to the user.
857826
void BackendConsumer::DiagnosticHandlerImpl(const DiagnosticInfo &DI) {
@@ -926,9 +895,6 @@ void BackendConsumer::DiagnosticHandlerImpl(const DiagnosticInfo &DI) {
926895
case llvm::DK_DontCall:
927896
DontCallDiagHandler(cast<DiagnosticInfoDontCall>(DI));
928897
return;
929-
case llvm::DK_MisExpect:
930-
MisExpectDiagHandler(cast<DiagnosticInfoMisExpect>(DI));
931-
return;
932898
default:
933899
// Plugin IDs are not bound to any value as they are set dynamically.
934900
ComputeDiagRemarkID(Severity, backend_plugin, DiagID);

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -106,20 +106,6 @@ using namespace driver;
106106
using namespace options;
107107
using namespace llvm::opt;
108108

109-
//===----------------------------------------------------------------------===//
110-
// Helpers.
111-
//===----------------------------------------------------------------------===//
112-
113-
// Parse misexpect tolerance argument value.
114-
// Valid option values are integers in the range [0, 100)
115-
inline Expected<Optional<uint64_t>> parseToleranceOption(StringRef Arg) {
116-
int64_t Val;
117-
if (Arg.getAsInteger(10, Val))
118-
return llvm::createStringError(llvm::inconvertibleErrorCode(),
119-
"Not an integer: %s", Arg.data());
120-
return Val;
121-
}
122-
123109
//===----------------------------------------------------------------------===//
124110
// Initialization.
125111
//===----------------------------------------------------------------------===//
@@ -1966,21 +1952,6 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
19661952
}
19671953
}
19681954

1969-
if (auto *arg =
1970-
Args.getLastArg(options::OPT_fdiagnostics_misexpect_tolerance_EQ)) {
1971-
auto ResultOrErr = parseToleranceOption(arg->getValue());
1972-
1973-
if (!ResultOrErr) {
1974-
Diags.Report(diag::err_drv_invalid_diagnotics_misexpect_tolerance)
1975-
<< "-fdiagnostics-misexpect-tolerance=";
1976-
} else {
1977-
Opts.DiagnosticsMisExpectTolerance = *ResultOrErr;
1978-
if (!UsingProfile)
1979-
Diags.Report(diag::warn_drv_diagnostics_misexpect_requires_pgo)
1980-
<< "-fdiagnostics-misexpect-tolerance=";
1981-
}
1982-
}
1983-
19841955
// If the user requested to use a sample profile for PGO, then the
19851956
// backend will need to track source location information so the profile
19861957
// can be incorporated into the IR.
@@ -4526,13 +4497,6 @@ bool CompilerInvocation::CreateFromArgsImpl(
45264497
if (Res.getFrontendOpts().ProgramAction == frontend::RewriteObjC)
45274498
LangOpts.ObjCExceptions = 1;
45284499

4529-
for (auto Warning : Res.getDiagnosticOpts().Warnings) {
4530-
if (Warning == "misexpect" &&
4531-
!Diags.isIgnored(diag::warn_profile_data_misexpect, SourceLocation())) {
4532-
Res.getCodeGenOpts().MisExpect = true;
4533-
}
4534-
}
4535-
45364500
if (LangOpts.CUDA) {
45374501
// During CUDA device-side compilation, the aux triple is the
45384502
// triple used for host compilation.

clang/test/Profile/Inputs/misexpect-branch-nonconst-expect-arg.proftext

Lines changed: 0 additions & 8 deletions
This file was deleted.

clang/test/Profile/Inputs/misexpect-branch.proftext

Lines changed: 0 additions & 17 deletions
This file was deleted.

clang/test/Profile/Inputs/misexpect-switch-default-only.proftext

Lines changed: 0 additions & 12 deletions
This file was deleted.

clang/test/Profile/Inputs/misexpect-switch-default.proftext

Lines changed: 0 additions & 16 deletions
This file was deleted.

clang/test/Profile/Inputs/misexpect-switch-nonconst.proftext

Lines changed: 0 additions & 16 deletions
This file was deleted.

clang/test/Profile/Inputs/misexpect-switch.proftext

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)