summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/OptimizationRemarkEmitter.cpp9
-rw-r--r--llvm/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp7
2 files changed, 9 insertions, 7 deletions
diff --git a/llvm/lib/Analysis/OptimizationRemarkEmitter.cpp b/llvm/lib/Analysis/OptimizationRemarkEmitter.cpp
index 4ff7611086e..cd6a9366801 100644
--- a/llvm/lib/Analysis/OptimizationRemarkEmitter.cpp
+++ b/llvm/lib/Analysis/OptimizationRemarkEmitter.cpp
@@ -75,10 +75,11 @@ void OptimizationRemarkEmitter::emit(
DiagnosticInfoOptimizationBase &OptDiagBase) {
auto &OptDiag = cast<DiagnosticInfoIROptimization>(OptDiagBase);
computeHotness(OptDiag);
-
- // Only emit it if its hotness meets the threshold.
- if (OptDiag.getHotness().getValueOr(0) <
- F->getContext().getDiagnosticsHotnessThreshold()) {
+ // If a diagnostic has a hotness value, then only emit it if its hotness
+ // meets the threshold.
+ if (OptDiag.getHotness() &&
+ *OptDiag.getHotness() <
+ F->getContext().getDiagnosticsHotnessThreshold()) {
return;
}
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