From 6100d16e7d63b377038a1da54bc25c66779bdafc Mon Sep 17 00:00:00 2001 From: Adam Nemet Date: Wed, 20 Jul 2016 21:44:22 +0000 Subject: [PATCH] [OptDiag] Take the IR Value as a const pointer This helps because LoopAccessReport is passed around as a const reference and we derive the basic block passed as the Value parameter from the instruction in LoopAccessReport. llvm-svn: 276191 --- llvm/include/llvm/Analysis/OptimizationDiagnosticInfo.h | 4 ++-- llvm/lib/Analysis/OptimizationDiagnosticInfo.cpp | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/llvm/include/llvm/Analysis/OptimizationDiagnosticInfo.h b/llvm/include/llvm/Analysis/OptimizationDiagnosticInfo.h index 4881751..71d989b 100644 --- a/llvm/include/llvm/Analysis/OptimizationDiagnosticInfo.h +++ b/llvm/include/llvm/Analysis/OptimizationDiagnosticInfo.h @@ -51,7 +51,7 @@ public: /// where the diagnostic is generated. \p V is the IR Value that identifies /// the code region. \p Msg is the message string to use. void emitOptimizationRemarkMissed(const char *PassName, const DebugLoc &DLoc, - Value *V, const Twine &Msg); + const Value *V, const Twine &Msg); /// \brief Same as above but derives the IR Value for the code region and the /// debug location from the Loop parameter \p L. @@ -63,7 +63,7 @@ private: BlockFrequencyInfo *BFI; - Optional computeHotness(Value *V); + Optional computeHotness(const Value *V); OptimizationRemarkEmitter(const OptimizationRemarkEmitter &) = delete; void operator=(const OptimizationRemarkEmitter &) = delete; diff --git a/llvm/lib/Analysis/OptimizationDiagnosticInfo.cpp b/llvm/lib/Analysis/OptimizationDiagnosticInfo.cpp index b844db2..910d194 100644 --- a/llvm/lib/Analysis/OptimizationDiagnosticInfo.cpp +++ b/llvm/lib/Analysis/OptimizationDiagnosticInfo.cpp @@ -20,7 +20,7 @@ using namespace llvm; -Optional OptimizationRemarkEmitter::computeHotness(Value *V) { +Optional OptimizationRemarkEmitter::computeHotness(const Value *V) { if (!BFI) return None; @@ -28,7 +28,8 @@ Optional OptimizationRemarkEmitter::computeHotness(Value *V) { } void OptimizationRemarkEmitter::emitOptimizationRemarkMissed( - const char *PassName, const DebugLoc &DLoc, Value *V, const Twine &Msg) { + const char *PassName, const DebugLoc &DLoc, const Value *V, + const Twine &Msg) { LLVMContext &Ctx = F->getContext(); Ctx.diagnose(DiagnosticInfoOptimizationRemarkMissed(PassName, *F, DLoc, Msg, computeHotness(V))); -- 2.7.4