summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp b/llvm/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp
index 91205d2f01e..ecc569dab83 100644
--- a/llvm/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp
+++ b/llvm/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp
@@ -53,9 +53,10 @@ void MachineOptimizationRemarkEmitter::emit(
LLVMContext &Ctx = MF.getFunction()->getContext();
- // Only emit it if its hotness meets the threshold.
- if (OptDiag.getHotness().getValueOr(0) <
- Ctx.getDiagnosticsHotnessThreshold()) {
+ // If a diagnostic has a hotness value, then only emit it if its hotness
+ // meets the threshold.
+ if (OptDiag.getHotness() &&
+ *OptDiag.getHotness() < Ctx.getDiagnosticsHotnessThreshold()) {
return;
}
OpenPOWER on IntegriCloud