[LoopAccesses] Split out LoopAccessReport from VectorizerReport

The only difference between these two is that VectorizerReport adds a
vectorizer-specific prefix to its messages.  When LAA is used in the
vectorizer context the prefix is added when we promote the
LoopAccessReport into a VectorizerReport via one of the constructors.

This is part of the patchset that converts LoopAccessAnalysis into an
actual analysis pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229632 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Adam Nemet
2015-02-18 03:44:25 +00:00
parent 69c9697fa7
commit c548c640bc
3 changed files with 56 additions and 34 deletions

View File

@@ -36,15 +36,18 @@ class SCEV;
/// Optimization analysis message produced during vectorization. Messages inform
/// the user why vectorization did not occur.
class VectorizationReport {
class LoopAccessReport {
std::string Message;
const Instruction *Instr;
public:
VectorizationReport(const Instruction *I = nullptr)
: Message("loop not vectorized: "), Instr(I) {}
protected:
LoopAccessReport(const Twine &Message, const Instruction *I)
: Message(Message.str()), Instr(I) {}
template <typename A> VectorizationReport &operator<<(const A &Value) {
public:
LoopAccessReport(const Instruction *I = nullptr) : Instr(I) {}
template <typename A> LoopAccessReport &operator<<(const A &Value) {
raw_string_ostream Out(Message);
Out << Value;
return *this;
@@ -59,7 +62,7 @@ public:
/// \brief Emit an analysis note for \p PassName with the debug location from
/// the instruction in \p Message if available. Otherwise use the location of
/// \p TheLoop.
static void emitAnalysis(const VectorizationReport &Message,
static void emitAnalysis(const LoopAccessReport &Message,
const Function *TheFunction,
const Loop *TheLoop,
const char *PassName);
@@ -169,7 +172,7 @@ public:
/// \brief The diagnostics report generated for the analysis. E.g. why we
/// couldn't analyze the loop.
Optional<VectorizationReport> &getReport() { return Report; }
Optional<LoopAccessReport> &getReport() { return Report; }
/// \brief Used to ensure that if the analysis was run with speculating the
/// value of symbolic strides, the client queries it with the same assumption.
@@ -184,7 +187,7 @@ private:
/// pass.
bool canAnalyzeLoop();
void emitAnalysis(VectorizationReport &Message);
void emitAnalysis(LoopAccessReport &Message);
/// We need to check that all of the pointers in this list are disjoint
/// at runtime.
@@ -206,7 +209,7 @@ private:
/// \brief The diagnostics report generated for the analysis. E.g. why we
/// couldn't analyze the loop.
Optional<VectorizationReport> Report;
Optional<LoopAccessReport> Report;
};
Value *stripIntegerCast(Value *V);