diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:10:56 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:10:56 +0000 |
commit | 044eb2f6afba375a914ac9d8024f8f5142bb912e (patch) | |
tree | 1475247dc9f9fe5be155ebd4c9069c75aadf8c20 /lib/CodeGen/MachineOptimizationRemarkEmitter.cpp | |
parent | eb70dddbd77e120e5d490bd8fbe7ff3f8fa81c6b (diff) |
Notes
Diffstat (limited to 'lib/CodeGen/MachineOptimizationRemarkEmitter.cpp')
-rw-r--r-- | lib/CodeGen/MachineOptimizationRemarkEmitter.cpp | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp b/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp index 73c3428a6e53..ca4452218da1 100644 --- a/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp +++ b/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp @@ -16,7 +16,6 @@ #include "llvm/CodeGen/MachineOptimizationRemarkEmitter.h" #include "llvm/CodeGen/LazyMachineBlockFrequencyInfo.h" #include "llvm/CodeGen/MachineInstr.h" -#include "llvm/IR/DebugInfo.h" #include "llvm/IR/DiagnosticInfo.h" #include "llvm/IR/LLVMContext.h" @@ -51,24 +50,15 @@ void MachineOptimizationRemarkEmitter::emit( auto &OptDiag = cast<DiagnosticInfoMIROptimization>(OptDiagCommon); computeHotness(OptDiag); - LLVMContext &Ctx = MF.getFunction()->getContext(); + LLVMContext &Ctx = MF.getFunction().getContext(); - // If a diagnostic has a hotness value, then only emit it if its hotness - // meets the threshold. - if (OptDiag.getHotness() && - *OptDiag.getHotness() < Ctx.getDiagnosticsHotnessThreshold()) { + // Only emit it if its hotness meets the threshold. + if (OptDiag.getHotness().getValueOr(0) < + Ctx.getDiagnosticsHotnessThreshold()) { return; } - yaml::Output *Out = Ctx.getDiagnosticsOutputFile(); - if (Out) { - auto *P = &const_cast<DiagnosticInfoOptimizationBase &>(OptDiagCommon); - *Out << P; - } - // FIXME: now that IsVerbose is part of DI, filtering for this will be moved - // from here to clang. - if (!OptDiag.isVerbose() || shouldEmitVerbose()) - Ctx.diagnose(OptDiag); + Ctx.diagnose(OptDiag); } MachineOptimizationRemarkEmitterPass::MachineOptimizationRemarkEmitterPass() @@ -81,7 +71,7 @@ bool MachineOptimizationRemarkEmitterPass::runOnMachineFunction( MachineFunction &MF) { MachineBlockFrequencyInfo *MBFI; - if (MF.getFunction()->getContext().getDiagnosticsHotnessRequested()) + if (MF.getFunction().getContext().getDiagnosticsHotnessRequested()) MBFI = &getAnalysis<LazyMachineBlockFrequencyInfoPass>().getBFI(); else MBFI = nullptr; |