diff lib/CodeGen/MachineOptimizationRemarkEmitter.cpp @ 134:3a76565eade5 LLVM5.0.1

update 5.0.1
author mir3636
date Sat, 17 Feb 2018 09:57:20 +0900
parents 803732b1fca8
children c2174574ed3a
line wrap: on
line diff
--- a/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp	Fri Feb 16 19:10:49 2018 +0900
+++ b/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp	Sat Feb 17 09:57:20 2018 +0900
@@ -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"
 
@@ -28,7 +27,8 @@
   Key = MKey;
 
   raw_string_ostream OS(Val);
-  MI.print(OS, /*SkipOpers=*/false, /*SkipDebugLoc=*/true);
+  MI.print(OS, /*IsStandalone=*/true, /*SkipOpers=*/false,
+           /*SkipDebugLoc=*/true);
 }
 
 Optional<uint64_t>
@@ -51,12 +51,11 @@
   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;
   }
 
@@ -73,7 +72,7 @@
     MachineFunction &MF) {
   MachineBlockFrequencyInfo *MBFI;
 
-  if (MF.getFunction()->getContext().getDiagnosticsHotnessRequested())
+  if (MF.getFunction().getContext().getDiagnosticsHotnessRequested())
     MBFI = &getAnalysis<LazyMachineBlockFrequencyInfoPass>().getBFI();
   else
     MBFI = nullptr;