summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2018-04-06 14:26:03 +0000
committerpatrick <patrick@openbsd.org>2018-04-06 14:26:03 +0000
commitbdabc2f19ffb9e20600dad6e8a300842a7bda50e (patch)
treec50e7b2e5449b074651bb82a58517a8ebc4a8cf7 /gnu/llvm/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp
parentPrint a 'p' flag for file descriptors that were opened after pledge(2). (diff)
downloadwireguard-openbsd-bdabc2f19ffb9e20600dad6e8a300842a7bda50e.tar.xz
wireguard-openbsd-bdabc2f19ffb9e20600dad6e8a300842a7bda50e.zip
Import LLVM 6.0.1 release including clang, lld and lldb.
"where is the kaboom?" deraadt@
Diffstat (limited to 'gnu/llvm/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp')
-rw-r--r--gnu/llvm/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp22
1 files changed, 6 insertions, 16 deletions
diff --git a/gnu/llvm/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp b/gnu/llvm/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp
index 73c3428a6e5..ca4452218da 100644
--- a/gnu/llvm/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp
+++ b/gnu/llvm/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;