[ORE] Unify spelling as "diagnostics hotness"

Summary:
To enable profile hotness information in diagnostics output, Clang takes
the option `-fdiagnostics-show-hotness` -- that's "diagnostics", with an
"s" at the end. Clang also defines `CodeGenOptions::DiagnosticsWithHotness`.

LLVM, on the other hand, defines
`LLVMContext::getDiagnosticHotnessRequested` -- that's "diagnostic", not
"diagnostics". It's a small difference, but it's confusing, typo-inducing, and
frustrating.

Add a new method with the spelling "diagnostics", and "deprecate" the
old spelling.

Reviewers: anemet, davidxl

Reviewed By: anemet

Subscribers: llvm-commits, mehdi_amini

Differential Revision: https://reviews.llvm.org/D34864

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306848 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Brian Gesiak 2017-06-30 18:13:59 +00:00
parent eef7226d49
commit 8e8ec784f8
10 changed files with 32 additions and 16 deletions

View File

@ -34,7 +34,7 @@ class Value;
///
/// It allows reporting when optimizations are performed and when they are not
/// along with the reasons for it. Hotness information of the corresponding
/// code region can be included in the remark if DiagnosticHotnessRequested is
/// code region can be included in the remark if DiagnosticsHotnessRequested is
/// enabled in the LLVM context.
class OptimizationRemarkEmitter {
public:
@ -45,10 +45,10 @@ public:
/// analysis pass).
///
/// Note that this ctor has a very different cost depending on whether
/// F->getContext().getDiagnosticHotnessRequested() is on or not. If it's off
/// F->getContext().getDiagnosticsHotnessRequested() is on or not. If it's off
/// the operation is free.
///
/// Whereas if DiagnosticHotnessRequested is on, it is fairly expensive
/// Whereas if DiagnosticsHotnessRequested is on, it is fairly expensive
/// operation since BFI and all its required analyses are computed. This is
/// for example useful for CGSCC passes that can't use function analyses
/// passes in the old PM.

View File

@ -134,7 +134,7 @@ using MNV = DiagnosticInfoMIROptimization::MachineArgument;
///
/// It allows reporting when optimizations are performed and when they are not
/// along with the reasons for it. Hotness information of the corresponding
/// code region can be included in the remark if DiagnosticHotnessRequested is
/// code region can be included in the remark if DiagnosticsHotnessRequested is
/// enabled in the LLVM context.
class MachineOptimizationRemarkEmitter {
public:

View File

@ -187,12 +187,21 @@ public:
void *getDiagnosticContext() const;
/// \brief Return if a code hotness metric should be included in optimization
/// diagnostics.
/// diagnostics. This method is deprecated; use getDiagnosticsHotnessRequested
/// instead.
bool getDiagnosticHotnessRequested() const;
/// \brief Set if a code hotness metric should be included in optimization
/// diagnostics.
/// diagnostics. This method is deprecated; use setDiagnosticsHotnessRequested
/// instead.
void setDiagnosticHotnessRequested(bool Requested);
/// \brief Return if a code hotness metric should be included in optimization
/// diagnostics.
bool getDiagnosticsHotnessRequested() const;
/// \brief Set if a code hotness metric should be included in optimization
/// diagnostics.
void setDiagnosticsHotnessRequested(bool Requested);
/// \brief Return the YAML file used by the backend to save optimization
/// diagnostics. If null, diagnostics are not saved in a file but only
/// emitted via the diagnostic handler.

View File

@ -25,7 +25,7 @@ using namespace llvm;
OptimizationRemarkEmitter::OptimizationRemarkEmitter(const Function *F)
: F(F), BFI(nullptr) {
if (!F->getContext().getDiagnosticHotnessRequested())
if (!F->getContext().getDiagnosticsHotnessRequested())
return;
// First create a dominator tree.
@ -176,7 +176,7 @@ OptimizationRemarkEmitterWrapperPass::OptimizationRemarkEmitterWrapperPass()
bool OptimizationRemarkEmitterWrapperPass::runOnFunction(Function &Fn) {
BlockFrequencyInfo *BFI;
if (Fn.getContext().getDiagnosticHotnessRequested())
if (Fn.getContext().getDiagnosticsHotnessRequested())
BFI = &getAnalysis<LazyBlockFrequencyInfoPass>().getBFI();
else
BFI = nullptr;
@ -198,7 +198,7 @@ OptimizationRemarkEmitterAnalysis::run(Function &F,
FunctionAnalysisManager &AM) {
BlockFrequencyInfo *BFI;
if (F.getContext().getDiagnosticHotnessRequested())
if (F.getContext().getDiagnosticsHotnessRequested())
BFI = &AM.getResult<BlockFrequencyAnalysis>(F);
else
BFI = nullptr;

View File

@ -73,7 +73,7 @@ bool MachineOptimizationRemarkEmitterPass::runOnMachineFunction(
MachineFunction &MF) {
MachineBlockFrequencyInfo *MBFI;
if (MF.getFunction()->getContext().getDiagnosticHotnessRequested())
if (MF.getFunction()->getContext().getDiagnosticsHotnessRequested())
MBFI = &getAnalysis<LazyMachineBlockFrequencyInfoPass>().getBFI();
else
MBFI = nullptr;

View File

@ -126,10 +126,17 @@ void LLVMContext::setDiagnosticHandler(DiagnosticHandlerTy DiagnosticHandler,
}
void LLVMContext::setDiagnosticHotnessRequested(bool Requested) {
pImpl->DiagnosticHotnessRequested = Requested;
pImpl->DiagnosticsHotnessRequested = Requested;
}
bool LLVMContext::getDiagnosticHotnessRequested() const {
return pImpl->DiagnosticHotnessRequested;
return pImpl->DiagnosticsHotnessRequested;
}
void LLVMContext::setDiagnosticsHotnessRequested(bool Requested) {
pImpl->DiagnosticsHotnessRequested = Requested;
}
bool LLVMContext::getDiagnosticsHotnessRequested() const {
return pImpl->DiagnosticsHotnessRequested;
}
yaml::Output *LLVMContext::getDiagnosticsOutputFile() {

View File

@ -1169,7 +1169,7 @@ public:
LLVMContext::DiagnosticHandlerTy DiagnosticHandler = nullptr;
void *DiagnosticContext = nullptr;
bool RespectDiagnosticFilters = false;
bool DiagnosticHotnessRequested = false;
bool DiagnosticsHotnessRequested = false;
std::unique_ptr<yaml::Output> DiagnosticsOutputFile;
LLVMContext::YieldCallbackTy YieldCallback = nullptr;

View File

@ -1123,7 +1123,7 @@ lto::setupOptimizationRemarks(LLVMContext &Context,
Context.setDiagnosticsOutputFile(
llvm::make_unique<yaml::Output>(DiagnosticFile->os()));
if (LTOPassRemarksWithHotness)
Context.setDiagnosticHotnessRequested(true);
Context.setDiagnosticsHotnessRequested(true);
DiagnosticFile->keep();
return std::move(DiagnosticFile);
}

View File

@ -323,7 +323,7 @@ int main(int argc, char **argv) {
Context.setInlineAsmDiagnosticHandler(InlineAsmDiagHandler, &HasError);
if (PassRemarksWithHotness)
Context.setDiagnosticHotnessRequested(true);
Context.setDiagnosticsHotnessRequested(true);
std::unique_ptr<tool_output_file> YamlFile;
if (RemarksFilename != "") {

View File

@ -420,7 +420,7 @@ int main(int argc, char **argv) {
Context.enableDebugTypeODRUniquing();
if (PassRemarksWithHotness)
Context.setDiagnosticHotnessRequested(true);
Context.setDiagnosticsHotnessRequested(true);
std::unique_ptr<tool_output_file> YamlFile;
if (RemarksFilename != "") {