[llvm] r296037 - [OptDiag] Hide legacy remark ctors
Adam Nemet via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 23 15:11:11 PST 2017
Author: anemet
Date: Thu Feb 23 17:11:11 2017
New Revision: 296037
URL: http://llvm.org/viewvc/llvm-project?rev=296037&view=rev
Log:
[OptDiag] Hide legacy remark ctors
These are only used when emitting remarks without ORE directly using the free
functions emitOptimizationRemark*.
Modified:
llvm/trunk/include/llvm/IR/DiagnosticInfo.h
llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp
Modified: llvm/trunk/include/llvm/IR/DiagnosticInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DiagnosticInfo.h?rev=296037&r1=296036&r2=296037&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DiagnosticInfo.h (original)
+++ llvm/trunk/include/llvm/IR/DiagnosticInfo.h Thu Feb 23 17:11:11 2017
@@ -581,20 +581,6 @@ private:
/// Diagnostic information for applied optimization remarks.
class OptimizationRemark : public DiagnosticInfoIROptimization {
public:
- /// \p PassName is the name of the pass emitting this diagnostic. If
- /// this name matches the regular expression given in -Rpass=, then the
- /// diagnostic will be emitted. \p Fn is the function where the diagnostic
- /// is being emitted. \p Loc is the location information to use in the
- /// diagnostic. If line table information is available, the diagnostic
- /// will include the source code location. \p Msg is the message to show.
- /// Note that this class does not copy this message, so this reference
- /// must be valid for the whole life time of the diagnostic.
- OptimizationRemark(const char *PassName, const Function &Fn,
- const DiagnosticLocation &Loc, const Twine &Msg,
- Optional<uint64_t> Hotness = None)
- : DiagnosticInfoIROptimization(DK_OptimizationRemark, DS_Remark, PassName,
- Fn, Loc, Msg, Hotness) {}
-
/// \p PassName is the name of the pass emitting this diagnostic. If this name
/// matches the regular expression given in -Rpass=, then the diagnostic will
/// be emitted. \p RemarkName is a textual identifier for the remark. \p
@@ -616,25 +602,32 @@ public:
/// \see DiagnosticInfoOptimizationBase::isEnabled.
bool isEnabled() const override { return isEnabled(getPassName()); }
-};
-/// Diagnostic information for missed-optimization remarks.
-class OptimizationRemarkMissed : public DiagnosticInfoIROptimization {
-public:
+private:
+ /// This is deprecated now and only used by the function API below.
/// \p PassName is the name of the pass emitting this diagnostic. If
- /// this name matches the regular expression given in -Rpass-missed=, then the
+ /// this name matches the regular expression given in -Rpass=, then the
/// diagnostic will be emitted. \p Fn is the function where the diagnostic
/// is being emitted. \p Loc is the location information to use in the
/// diagnostic. If line table information is available, the diagnostic
/// will include the source code location. \p Msg is the message to show.
/// Note that this class does not copy this message, so this reference
/// must be valid for the whole life time of the diagnostic.
- OptimizationRemarkMissed(const char *PassName, const Function &Fn,
- const DiagnosticLocation &Loc, const Twine &Msg,
- Optional<uint64_t> Hotness = None)
- : DiagnosticInfoIROptimization(DK_OptimizationRemarkMissed, DS_Remark,
- PassName, Fn, Loc, Msg, Hotness) {}
+ OptimizationRemark(const char *PassName, const Function &Fn,
+ const DiagnosticLocation &Loc, const Twine &Msg,
+ Optional<uint64_t> Hotness = None)
+ : DiagnosticInfoIROptimization(DK_OptimizationRemark, DS_Remark, PassName,
+ Fn, Loc, Msg, Hotness) {}
+ friend void emitOptimizationRemark(LLVMContext &Ctx, const char *PassName,
+ const Function &Fn,
+ const DiagnosticLocation &Loc,
+ const Twine &Msg);
+};
+
+/// Diagnostic information for missed-optimization remarks.
+class OptimizationRemarkMissed : public DiagnosticInfoIROptimization {
+public:
/// \p PassName is the name of the pass emitting this diagnostic. If this name
/// matches the regular expression given in -Rpass-missed=, then the
/// diagnostic will be emitted. \p RemarkName is a textual identifier for the
@@ -657,25 +650,33 @@ public:
/// \see DiagnosticInfoOptimizationBase::isEnabled.
bool isEnabled() const override { return isEnabled(getPassName()); }
-};
-/// Diagnostic information for optimization analysis remarks.
-class OptimizationRemarkAnalysis : public DiagnosticInfoIROptimization {
-public:
+private:
+ /// This is deprecated now and only used by the function API below.
/// \p PassName is the name of the pass emitting this diagnostic. If
- /// this name matches the regular expression given in -Rpass-analysis=, then
- /// the diagnostic will be emitted. \p Fn is the function where the diagnostic
+ /// this name matches the regular expression given in -Rpass-missed=, then the
+ /// diagnostic will be emitted. \p Fn is the function where the diagnostic
/// is being emitted. \p Loc is the location information to use in the
- /// diagnostic. If line table information is available, the diagnostic will
- /// include the source code location. \p Msg is the message to show. Note that
- /// this class does not copy this message, so this reference must be valid for
- /// the whole life time of the diagnostic.
- OptimizationRemarkAnalysis(const char *PassName, const Function &Fn,
- const DiagnosticLocation &Loc, const Twine &Msg,
- Optional<uint64_t> Hotness = None)
- : DiagnosticInfoIROptimization(DK_OptimizationRemarkAnalysis, DS_Remark,
+ /// diagnostic. If line table information is available, the diagnostic
+ /// will include the source code location. \p Msg is the message to show.
+ /// Note that this class does not copy this message, so this reference
+ /// must be valid for the whole life time of the diagnostic.
+ OptimizationRemarkMissed(const char *PassName, const Function &Fn,
+ const DiagnosticLocation &Loc, const Twine &Msg,
+ Optional<uint64_t> Hotness = None)
+ : DiagnosticInfoIROptimization(DK_OptimizationRemarkMissed, DS_Remark,
PassName, Fn, Loc, Msg, Hotness) {}
+ friend void emitOptimizationRemarkMissed(LLVMContext &Ctx,
+ const char *PassName,
+ const Function &Fn,
+ const DiagnosticLocation &Loc,
+ const Twine &Msg);
+};
+
+/// Diagnostic information for optimization analysis remarks.
+class OptimizationRemarkAnalysis : public DiagnosticInfoIROptimization {
+public:
/// \p PassName is the name of the pass emitting this diagnostic. If this name
/// matches the regular expression given in -Rpass-analysis=, then the
/// diagnostic will be emitted. \p RemarkName is a textual identifier for the
@@ -727,29 +728,34 @@ protected:
StringRef RemarkName,
const DiagnosticLocation &Loc,
const Value *CodeRegion);
-};
-/// Diagnostic information for optimization analysis remarks related to
-/// floating-point non-commutativity.
-class OptimizationRemarkAnalysisFPCommute : public OptimizationRemarkAnalysis {
-public:
+private:
+ /// This is deprecated now and only used by the function API below.
/// \p PassName is the name of the pass emitting this diagnostic. If
/// this name matches the regular expression given in -Rpass-analysis=, then
/// the diagnostic will be emitted. \p Fn is the function where the diagnostic
/// is being emitted. \p Loc is the location information to use in the
/// diagnostic. If line table information is available, the diagnostic will
- /// include the source code location. \p Msg is the message to show. The
- /// front-end will append its own message related to options that address
- /// floating-point non-commutativity. Note that this class does not copy this
- /// message, so this reference must be valid for the whole life time of the
- /// diagnostic.
- OptimizationRemarkAnalysisFPCommute(const char *PassName, const Function &Fn,
- const DiagnosticLocation &Loc,
- const Twine &Msg,
- Optional<uint64_t> Hotness = None)
- : OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisFPCommute,
- PassName, Fn, Loc, Msg, Hotness) {}
+ /// include the source code location. \p Msg is the message to show. Note that
+ /// this class does not copy this message, so this reference must be valid for
+ /// the whole life time of the diagnostic.
+ OptimizationRemarkAnalysis(const char *PassName, const Function &Fn,
+ const DiagnosticLocation &Loc, const Twine &Msg,
+ Optional<uint64_t> Hotness = None)
+ : DiagnosticInfoIROptimization(DK_OptimizationRemarkAnalysis, DS_Remark,
+ PassName, Fn, Loc, Msg, Hotness) {}
+ friend void emitOptimizationRemarkAnalysis(LLVMContext &Ctx,
+ const char *PassName,
+ const Function &Fn,
+ const DiagnosticLocation &Loc,
+ const Twine &Msg);
+};
+
+/// Diagnostic information for optimization analysis remarks related to
+/// floating-point non-commutativity.
+class OptimizationRemarkAnalysisFPCommute : public OptimizationRemarkAnalysis {
+public:
/// \p PassName is the name of the pass emitting this diagnostic. If this name
/// matches the regular expression given in -Rpass-analysis=, then the
/// diagnostic will be emitted. \p RemarkName is a textual identifier for the
@@ -767,12 +773,9 @@ public:
static bool classof(const DiagnosticInfo *DI) {
return DI->getKind() == DK_OptimizationRemarkAnalysisFPCommute;
}
-};
-/// Diagnostic information for optimization analysis remarks related to
-/// pointer aliasing.
-class OptimizationRemarkAnalysisAliasing : public OptimizationRemarkAnalysis {
-public:
+private:
+ /// This is deprecated now and only used by the function API below.
/// \p PassName is the name of the pass emitting this diagnostic. If
/// this name matches the regular expression given in -Rpass-analysis=, then
/// the diagnostic will be emitted. \p Fn is the function where the diagnostic
@@ -780,16 +783,24 @@ public:
/// diagnostic. If line table information is available, the diagnostic will
/// include the source code location. \p Msg is the message to show. The
/// front-end will append its own message related to options that address
- /// pointer aliasing legality. Note that this class does not copy this
+ /// floating-point non-commutativity. Note that this class does not copy this
/// message, so this reference must be valid for the whole life time of the
/// diagnostic.
- OptimizationRemarkAnalysisAliasing(const char *PassName, const Function &Fn,
- const DiagnosticLocation &Loc,
- const Twine &Msg,
- Optional<uint64_t> Hotness = None)
- : OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisAliasing,
+ OptimizationRemarkAnalysisFPCommute(const char *PassName, const Function &Fn,
+ const DiagnosticLocation &Loc,
+ const Twine &Msg,
+ Optional<uint64_t> Hotness = None)
+ : OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisFPCommute,
PassName, Fn, Loc, Msg, Hotness) {}
+ friend void emitOptimizationRemarkAnalysisFPCommute(
+ LLVMContext &Ctx, const char *PassName, const Function &Fn,
+ const DiagnosticLocation &Loc, const Twine &Msg);
+};
+/// Diagnostic information for optimization analysis remarks related to
+/// pointer aliasing.
+class OptimizationRemarkAnalysisAliasing : public OptimizationRemarkAnalysis {
+public:
/// \p PassName is the name of the pass emitting this diagnostic. If this name
/// matches the regular expression given in -Rpass-analysis=, then the
/// diagnostic will be emitted. \p RemarkName is a textual identifier for the
@@ -806,6 +817,29 @@ public:
static bool classof(const DiagnosticInfo *DI) {
return DI->getKind() == DK_OptimizationRemarkAnalysisAliasing;
}
+
+private:
+ /// This is deprecated now and only used by the function API below.
+ /// \p PassName is the name of the pass emitting this diagnostic. If
+ /// this name matches the regular expression given in -Rpass-analysis=, then
+ /// the diagnostic will be emitted. \p Fn is the function where the diagnostic
+ /// is being emitted. \p Loc is the location information to use in the
+ /// diagnostic. If line table information is available, the diagnostic will
+ /// include the source code location. \p Msg is the message to show. The
+ /// front-end will append its own message related to options that address
+ /// pointer aliasing legality. Note that this class does not copy this
+ /// message, so this reference must be valid for the whole life time of the
+ /// diagnostic.
+ OptimizationRemarkAnalysisAliasing(const char *PassName, const Function &Fn,
+ const DiagnosticLocation &Loc,
+ const Twine &Msg,
+ Optional<uint64_t> Hotness = None)
+ : OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisAliasing,
+ PassName, Fn, Loc, Msg, Hotness) {}
+
+ friend void emitOptimizationRemarkAnalysisAliasing(
+ LLVMContext &Ctx, const char *PassName, const Function &Fn,
+ const DiagnosticLocation &Loc, const Twine &Msg);
};
/// Diagnostic information for machine IR parser.
Modified: llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp?rev=296037&r1=296036&r2=296037&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp Thu Feb 23 17:11:11 2017
@@ -896,7 +896,11 @@ bool DevirtModule::areRemarksEnabled() {
if (FL.empty())
return false;
const Function &Fn = FL.front();
- auto DI = OptimizationRemark(DEBUG_TYPE, Fn, DebugLoc(), "");
+
+ const auto &BBL = Fn.getBasicBlockList();
+ if (BBL.empty())
+ return false;
+ auto DI = OptimizationRemark(DEBUG_TYPE, "", DebugLoc(), &BBL.front());
return DI.isEnabled();
}
More information about the llvm-commits
mailing list