llvm.org GIT mirror llvm / 8e8ec78
[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 Brian Gesiak 3 years ago
10 changed file(s) with 32 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
3333 ///
3434 /// It allows reporting when optimizations are performed and when they are not
3535 /// along with the reasons for it. Hotness information of the corresponding
36 /// code region can be included in the remark if DiagnosticHotnessRequested is
36 /// code region can be included in the remark if DiagnosticsHotnessRequested is
3737 /// enabled in the LLVM context.
3838 class OptimizationRemarkEmitter {
3939 public:
4444 /// analysis pass).
4545 ///
4646 /// Note that this ctor has a very different cost depending on whether
47 /// F->getContext().getDiagnosticHotnessRequested() is on or not. If it's off
47 /// F->getContext().getDiagnosticsHotnessRequested() is on or not. If it's off
4848 /// the operation is free.
4949 ///
50 /// Whereas if DiagnosticHotnessRequested is on, it is fairly expensive
50 /// Whereas if DiagnosticsHotnessRequested is on, it is fairly expensive
5151 /// operation since BFI and all its required analyses are computed. This is
5252 /// for example useful for CGSCC passes that can't use function analyses
5353 /// passes in the old PM.
133133 ///
134134 /// It allows reporting when optimizations are performed and when they are not
135135 /// along with the reasons for it. Hotness information of the corresponding
136 /// code region can be included in the remark if DiagnosticHotnessRequested is
136 /// code region can be included in the remark if DiagnosticsHotnessRequested is
137137 /// enabled in the LLVM context.
138138 class MachineOptimizationRemarkEmitter {
139139 public:
186186 void *getDiagnosticContext() const;
187187
188188 /// \brief Return if a code hotness metric should be included in optimization
189 /// diagnostics.
189 /// diagnostics. This method is deprecated; use getDiagnosticsHotnessRequested
190 /// instead.
190191 bool getDiagnosticHotnessRequested() const;
191192 /// \brief Set if a code hotness metric should be included in optimization
193 /// diagnostics. This method is deprecated; use setDiagnosticsHotnessRequested
194 /// instead.
195 void setDiagnosticHotnessRequested(bool Requested);
196
197 /// \brief Return if a code hotness metric should be included in optimization
192198 /// diagnostics.
193 void setDiagnosticHotnessRequested(bool Requested);
199 bool getDiagnosticsHotnessRequested() const;
200 /// \brief Set if a code hotness metric should be included in optimization
201 /// diagnostics.
202 void setDiagnosticsHotnessRequested(bool Requested);
194203
195204 /// \brief Return the YAML file used by the backend to save optimization
196205 /// diagnostics. If null, diagnostics are not saved in a file but only
2424
2525 OptimizationRemarkEmitter::OptimizationRemarkEmitter(const Function *F)
2626 : F(F), BFI(nullptr) {
27 if (!F->getContext().getDiagnosticHotnessRequested())
27 if (!F->getContext().getDiagnosticsHotnessRequested())
2828 return;
2929
3030 // First create a dominator tree.
175175 bool OptimizationRemarkEmitterWrapperPass::runOnFunction(Function &Fn) {
176176 BlockFrequencyInfo *BFI;
177177
178 if (Fn.getContext().getDiagnosticHotnessRequested())
178 if (Fn.getContext().getDiagnosticsHotnessRequested())
179179 BFI = &getAnalysis().getBFI();
180180 else
181181 BFI = nullptr;
197197 FunctionAnalysisManager &AM) {
198198 BlockFrequencyInfo *BFI;
199199
200 if (F.getContext().getDiagnosticHotnessRequested())
200 if (F.getContext().getDiagnosticsHotnessRequested())
201201 BFI = &AM.getResult(F);
202202 else
203203 BFI = nullptr;
7272 MachineFunction &MF) {
7373 MachineBlockFrequencyInfo *MBFI;
7474
75 if (MF.getFunction()->getContext().getDiagnosticHotnessRequested())
75 if (MF.getFunction()->getContext().getDiagnosticsHotnessRequested())
7676 MBFI = &getAnalysis().getBFI();
7777 else
7878 MBFI = nullptr;
125125 }
126126
127127 void LLVMContext::setDiagnosticHotnessRequested(bool Requested) {
128 pImpl->DiagnosticHotnessRequested = Requested;
128 pImpl->DiagnosticsHotnessRequested = Requested;
129129 }
130130 bool LLVMContext::getDiagnosticHotnessRequested() const {
131 return pImpl->DiagnosticHotnessRequested;
131 return pImpl->DiagnosticsHotnessRequested;
132 }
133
134 void LLVMContext::setDiagnosticsHotnessRequested(bool Requested) {
135 pImpl->DiagnosticsHotnessRequested = Requested;
136 }
137 bool LLVMContext::getDiagnosticsHotnessRequested() const {
138 return pImpl->DiagnosticsHotnessRequested;
132139 }
133140
134141 yaml::Output *LLVMContext::getDiagnosticsOutputFile() {
11681168 LLVMContext::DiagnosticHandlerTy DiagnosticHandler = nullptr;
11691169 void *DiagnosticContext = nullptr;
11701170 bool RespectDiagnosticFilters = false;
1171 bool DiagnosticHotnessRequested = false;
1171 bool DiagnosticsHotnessRequested = false;
11721172 std::unique_ptr DiagnosticsOutputFile;
11731173
11741174 LLVMContext::YieldCallbackTy YieldCallback = nullptr;
11221122 Context.setDiagnosticsOutputFile(
11231123 llvm::make_unique(DiagnosticFile->os()));
11241124 if (LTOPassRemarksWithHotness)
1125 Context.setDiagnosticHotnessRequested(true);
1125 Context.setDiagnosticsHotnessRequested(true);
11261126 DiagnosticFile->keep();
11271127 return std::move(DiagnosticFile);
11281128 }
322322 Context.setInlineAsmDiagnosticHandler(InlineAsmDiagHandler, &HasError);
323323
324324 if (PassRemarksWithHotness)
325 Context.setDiagnosticHotnessRequested(true);
325 Context.setDiagnosticsHotnessRequested(true);
326326
327327 std::unique_ptr YamlFile;
328328 if (RemarksFilename != "") {
419419 Context.enableDebugTypeODRUniquing();
420420
421421 if (PassRemarksWithHotness)
422 Context.setDiagnosticHotnessRequested(true);
422 Context.setDiagnosticsHotnessRequested(true);
423423
424424 std::unique_ptr YamlFile;
425425 if (RemarksFilename != "") {