Shorten DiagnosticInfoOptimizationRemark* to OptimizationRemark*. NFC

With the new streaming interface, these class names need to be typed a
lot and it's way too looong.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282544 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Adam Nemet 2016-09-27 22:19:23 +00:00
parent dcf371dfad
commit 0552c8c45a
7 changed files with 55 additions and 70 deletions

View File

@ -481,7 +481,7 @@ private:
};
/// Diagnostic information for applied optimization remarks.
class DiagnosticInfoOptimizationRemark : public DiagnosticInfoOptimizationBase {
class OptimizationRemark : public DiagnosticInfoOptimizationBase {
public:
/// \p PassName is the name of the pass emitting this diagnostic. If
/// this name matches the regular expression given in -Rpass=, then the
@ -491,9 +491,9 @@ public:
/// 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.
DiagnosticInfoOptimizationRemark(const char *PassName, const Function &Fn,
const DebugLoc &DLoc, const Twine &Msg,
Optional<uint64_t> Hotness = None)
OptimizationRemark(const char *PassName, const Function &Fn,
const DebugLoc &DLoc, const Twine &Msg,
Optional<uint64_t> Hotness = None)
: DiagnosticInfoOptimizationBase(DK_OptimizationRemark, DS_Remark,
PassName, Fn, DLoc, Msg, Hotness) {}
@ -506,8 +506,7 @@ public:
};
/// Diagnostic information for missed-optimization remarks.
class DiagnosticInfoOptimizationRemarkMissed
: public DiagnosticInfoOptimizationBase {
class OptimizationRemarkMissed : public DiagnosticInfoOptimizationBase {
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
@ -517,10 +516,9 @@ public:
/// 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.
DiagnosticInfoOptimizationRemarkMissed(const char *PassName,
const Function &Fn,
const DebugLoc &DLoc, const Twine &Msg,
Optional<uint64_t> Hotness = None)
OptimizationRemarkMissed(const char *PassName, const Function &Fn,
const DebugLoc &DLoc, const Twine &Msg,
Optional<uint64_t> Hotness = None)
: DiagnosticInfoOptimizationBase(DK_OptimizationRemarkMissed, DS_Remark,
PassName, Fn, DLoc, Msg, Hotness) {}
@ -528,9 +526,8 @@ public:
/// matches the regular expression given in -Rpass-missed=, then the
/// diagnostic will be emitted. \p RemarkName is a textual identifier for the
/// remark. \p Inst is the instruction that the optimization operates on.
DiagnosticInfoOptimizationRemarkMissed(const char *PassName,
StringRef RemarkName,
Instruction *Inst);
OptimizationRemarkMissed(const char *PassName, StringRef RemarkName,
Instruction *Inst);
static bool classof(const DiagnosticInfo *DI) {
return DI->getKind() == DK_OptimizationRemarkMissed;
@ -541,8 +538,7 @@ public:
};
/// Diagnostic information for optimization analysis remarks.
class DiagnosticInfoOptimizationRemarkAnalysis
: public DiagnosticInfoOptimizationBase {
class OptimizationRemarkAnalysis : public DiagnosticInfoOptimizationBase {
public:
/// \p PassName is the name of the pass emitting this diagnostic. If
/// this name matches the regular expression given in -Rpass-analysis=, then
@ -552,11 +548,9 @@ public:
/// 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.
DiagnosticInfoOptimizationRemarkAnalysis(const char *PassName,
const Function &Fn,
const DebugLoc &DLoc,
const Twine &Msg,
Optional<uint64_t> Hotness = None)
OptimizationRemarkAnalysis(const char *PassName, const Function &Fn,
const DebugLoc &DLoc, const Twine &Msg,
Optional<uint64_t> Hotness = None)
: DiagnosticInfoOptimizationBase(DK_OptimizationRemarkAnalysis, DS_Remark,
PassName, Fn, DLoc, Msg, Hotness) {}
@ -572,17 +566,16 @@ public:
bool shouldAlwaysPrint() const { return getPassName() == AlwaysPrint; }
protected:
DiagnosticInfoOptimizationRemarkAnalysis(
enum DiagnosticKind Kind, const char *PassName, const Function &Fn,
const DebugLoc &DLoc, const Twine &Msg, Optional<uint64_t> Hotness)
OptimizationRemarkAnalysis(enum DiagnosticKind Kind, const char *PassName,
const Function &Fn, const DebugLoc &DLoc,
const Twine &Msg, Optional<uint64_t> Hotness)
: DiagnosticInfoOptimizationBase(Kind, DS_Remark, PassName, Fn, DLoc, Msg,
Hotness) {}
};
/// Diagnostic information for optimization analysis remarks related to
/// floating-point non-commutativity.
class DiagnosticInfoOptimizationRemarkAnalysisFPCommute
: public DiagnosticInfoOptimizationRemarkAnalysis {
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
@ -594,12 +587,11 @@ public:
/// 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.
DiagnosticInfoOptimizationRemarkAnalysisFPCommute(
const char *PassName, const Function &Fn, const DebugLoc &DLoc,
const Twine &Msg, Optional<uint64_t> Hotness = None)
: DiagnosticInfoOptimizationRemarkAnalysis(
DK_OptimizationRemarkAnalysisFPCommute, PassName, Fn, DLoc, Msg,
Hotness) {}
OptimizationRemarkAnalysisFPCommute(const char *PassName, const Function &Fn,
const DebugLoc &DLoc, const Twine &Msg,
Optional<uint64_t> Hotness = None)
: OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisFPCommute,
PassName, Fn, DLoc, Msg, Hotness) {}
static bool classof(const DiagnosticInfo *DI) {
return DI->getKind() == DK_OptimizationRemarkAnalysisFPCommute;
@ -608,8 +600,7 @@ public:
/// Diagnostic information for optimization analysis remarks related to
/// pointer aliasing.
class DiagnosticInfoOptimizationRemarkAnalysisAliasing
: public DiagnosticInfoOptimizationRemarkAnalysis {
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
@ -621,12 +612,11 @@ public:
/// 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.
DiagnosticInfoOptimizationRemarkAnalysisAliasing(
const char *PassName, const Function &Fn, const DebugLoc &DLoc,
const Twine &Msg, Optional<uint64_t> Hotness = None)
: DiagnosticInfoOptimizationRemarkAnalysis(
DK_OptimizationRemarkAnalysisAliasing, PassName, Fn, DLoc, Msg,
Hotness) {}
OptimizationRemarkAnalysisAliasing(const char *PassName, const Function &Fn,
const DebugLoc &DLoc, const Twine &Msg,
Optional<uint64_t> Hotness = None)
: OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisAliasing,
PassName, Fn, DLoc, Msg, Hotness) {}
static bool classof(const DiagnosticInfo *DI) {
return DI->getKind() == DK_OptimizationRemarkAnalysisAliasing;

View File

@ -141,8 +141,7 @@ void OptimizationRemarkEmitter::emitOptimizationRemark(const char *PassName,
const Value *V,
const Twine &Msg) {
LLVMContext &Ctx = F->getContext();
Ctx.diagnose(DiagnosticInfoOptimizationRemark(PassName, *F, DLoc, Msg,
computeHotness(V)));
Ctx.diagnose(OptimizationRemark(PassName, *F, DLoc, Msg, computeHotness(V)));
}
void OptimizationRemarkEmitter::emitOptimizationRemark(const char *PassName,
@ -156,8 +155,8 @@ void OptimizationRemarkEmitter::emitOptimizationRemarkMissed(
const Twine &Msg, bool IsVerbose) {
LLVMContext &Ctx = F->getContext();
if (!IsVerbose || shouldEmitVerbose())
Ctx.diagnose(DiagnosticInfoOptimizationRemarkMissed(PassName, *F, DLoc, Msg,
computeHotness(V)));
Ctx.diagnose(
OptimizationRemarkMissed(PassName, *F, DLoc, Msg, computeHotness(V)));
}
void OptimizationRemarkEmitter::emitOptimizationRemarkMissed(
@ -171,8 +170,8 @@ void OptimizationRemarkEmitter::emitOptimizationRemarkAnalysis(
const Twine &Msg, bool IsVerbose) {
LLVMContext &Ctx = F->getContext();
if (!IsVerbose || shouldEmitVerbose())
Ctx.diagnose(DiagnosticInfoOptimizationRemarkAnalysis(
PassName, *F, DLoc, Msg, computeHotness(V)));
Ctx.diagnose(
OptimizationRemarkAnalysis(PassName, *F, DLoc, Msg, computeHotness(V)));
}
void OptimizationRemarkEmitter::emitOptimizationRemarkAnalysis(
@ -185,16 +184,16 @@ void OptimizationRemarkEmitter::emitOptimizationRemarkAnalysisFPCommute(
const char *PassName, const DebugLoc &DLoc, const Value *V,
const Twine &Msg) {
LLVMContext &Ctx = F->getContext();
Ctx.diagnose(DiagnosticInfoOptimizationRemarkAnalysisFPCommute(
PassName, *F, DLoc, Msg, computeHotness(V)));
Ctx.diagnose(OptimizationRemarkAnalysisFPCommute(PassName, *F, DLoc, Msg,
computeHotness(V)));
}
void OptimizationRemarkEmitter::emitOptimizationRemarkAnalysisAliasing(
const char *PassName, const DebugLoc &DLoc, const Value *V,
const Twine &Msg) {
LLVMContext &Ctx = F->getContext();
Ctx.diagnose(DiagnosticInfoOptimizationRemarkAnalysisAliasing(
PassName, *F, DLoc, Msg, computeHotness(V)));
Ctx.diagnose(OptimizationRemarkAnalysisAliasing(PassName, *F, DLoc, Msg,
computeHotness(V)));
}
void OptimizationRemarkEmitter::emitOptimizationRemarkAnalysisAliasing(

View File

@ -92,7 +92,7 @@ int llvm::getNextAvailablePluginDiagnosticKind() {
return ++PluginKindID;
}
const char *DiagnosticInfoOptimizationRemarkAnalysis::AlwaysPrint = "";
const char *OptimizationRemarkAnalysis::AlwaysPrint = "";
DiagnosticInfoInlineAsm::DiagnosticInfoInlineAsm(const Instruction &I,
const Twine &MsgStr,
@ -180,24 +180,25 @@ void DiagnosticInfoOptimizationBase::print(DiagnosticPrinter &DP) const {
DP << " (hotness: " << *Hotness << ")";
}
bool DiagnosticInfoOptimizationRemark::isEnabled() const {
bool OptimizationRemark::isEnabled() const {
return PassRemarksOptLoc.Pattern &&
PassRemarksOptLoc.Pattern->match(getPassName());
}
DiagnosticInfoOptimizationRemarkMissed::DiagnosticInfoOptimizationRemarkMissed(
const char *PassName, StringRef RemarkName, Instruction *Inst)
OptimizationRemarkMissed::OptimizationRemarkMissed(const char *PassName,
StringRef RemarkName,
Instruction *Inst)
: DiagnosticInfoOptimizationBase(DK_OptimizationRemarkMissed, DS_Remark,
PassName, RemarkName,
*Inst->getParent()->getParent(),
Inst->getDebugLoc(), Inst->getParent()) {}
bool DiagnosticInfoOptimizationRemarkMissed::isEnabled() const {
bool OptimizationRemarkMissed::isEnabled() const {
return PassRemarksMissedOptLoc.Pattern &&
PassRemarksMissedOptLoc.Pattern->match(getPassName());
}
bool DiagnosticInfoOptimizationRemarkAnalysis::isEnabled() const {
bool OptimizationRemarkAnalysis::isEnabled() const {
return shouldAlwaysPrint() ||
(PassRemarksAnalysisOptLoc.Pattern &&
PassRemarksAnalysisOptLoc.Pattern->match(getPassName()));
@ -210,14 +211,14 @@ void DiagnosticInfoMIRParser::print(DiagnosticPrinter &DP) const {
void llvm::emitOptimizationRemark(LLVMContext &Ctx, const char *PassName,
const Function &Fn, const DebugLoc &DLoc,
const Twine &Msg) {
Ctx.diagnose(DiagnosticInfoOptimizationRemark(PassName, Fn, DLoc, Msg));
Ctx.diagnose(OptimizationRemark(PassName, Fn, DLoc, Msg));
}
void llvm::emitOptimizationRemarkMissed(LLVMContext &Ctx, const char *PassName,
const Function &Fn,
const DebugLoc &DLoc,
const Twine &Msg) {
Ctx.diagnose(DiagnosticInfoOptimizationRemarkMissed(PassName, Fn, DLoc, Msg));
Ctx.diagnose(OptimizationRemarkMissed(PassName, Fn, DLoc, Msg));
}
void llvm::emitOptimizationRemarkAnalysis(LLVMContext &Ctx,
@ -225,8 +226,7 @@ void llvm::emitOptimizationRemarkAnalysis(LLVMContext &Ctx,
const Function &Fn,
const DebugLoc &DLoc,
const Twine &Msg) {
Ctx.diagnose(
DiagnosticInfoOptimizationRemarkAnalysis(PassName, Fn, DLoc, Msg));
Ctx.diagnose(OptimizationRemarkAnalysis(PassName, Fn, DLoc, Msg));
}
void llvm::emitOptimizationRemarkAnalysisFPCommute(LLVMContext &Ctx,
@ -234,8 +234,7 @@ void llvm::emitOptimizationRemarkAnalysisFPCommute(LLVMContext &Ctx,
const Function &Fn,
const DebugLoc &DLoc,
const Twine &Msg) {
Ctx.diagnose(DiagnosticInfoOptimizationRemarkAnalysisFPCommute(PassName, Fn,
DLoc, Msg));
Ctx.diagnose(OptimizationRemarkAnalysisFPCommute(PassName, Fn, DLoc, Msg));
}
void llvm::emitOptimizationRemarkAnalysisAliasing(LLVMContext &Ctx,
@ -243,8 +242,7 @@ void llvm::emitOptimizationRemarkAnalysisAliasing(LLVMContext &Ctx,
const Function &Fn,
const DebugLoc &DLoc,
const Twine &Msg) {
Ctx.diagnose(DiagnosticInfoOptimizationRemarkAnalysisAliasing(PassName, Fn,
DLoc, Msg));
Ctx.diagnose(OptimizationRemarkAnalysisAliasing(PassName, Fn, DLoc, Msg));
}
bool DiagnosticInfoOptimizationFailure::isEnabled() const {

View File

@ -470,8 +470,7 @@ inlineCallsImpl(CallGraphSCC &SCC, CallGraph &CG,
if (Function *Callee = CS.getCalledFunction())
if (Callee->isDeclaration()) {
using namespace ore;
ORE.emit(DiagnosticInfoOptimizationRemarkMissed(DEBUG_TYPE,
"NoDefinition", &I)
ORE.emit(OptimizationRemarkMissed(DEBUG_TYPE, "NoDefinition", &I)
<< NV("Callee", Callee) << " will not be inlined into "
<< NV("Caller", CS.getCaller())
<< " because its definition is unavailable"

View File

@ -710,7 +710,7 @@ bool DevirtModule::areRemarksEnabled() {
if (FL.empty())
return false;
const Function &Fn = FL.front();
auto DI = DiagnosticInfoOptimizationRemark(DEBUG_TYPE, Fn, DebugLoc(), "");
auto DI = OptimizationRemark(DEBUG_TYPE, Fn, DebugLoc(), "");
return DI.isEnabled();
}

View File

@ -769,9 +769,8 @@ public:
// With Rpass-analysis report why. This is on by default if distribution
// was requested explicitly.
ORE->emitOptimizationRemarkAnalysis(
Forced ? DiagnosticInfoOptimizationRemarkAnalysis::AlwaysPrint
: LDIST_NAME,
L, Twine("loop not distributed: ") + Message);
Forced ? OptimizationRemarkAnalysis::AlwaysPrint : LDIST_NAME, L,
Twine("loop not distributed: ") + Message);
// Also issue a warning if distribution was requested explicitly but it
// failed.

View File

@ -1298,7 +1298,7 @@ public:
return LV_NAME;
if (getForce() == LoopVectorizeHints::FK_Undefined && getWidth() == 0)
return LV_NAME;
return DiagnosticInfoOptimizationRemarkAnalysis::AlwaysPrint;
return OptimizationRemarkAnalysis::AlwaysPrint;
}
bool allowReordering() const {