summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/Analysis/LoopAccessAnalysis.h9
-rw-r--r--llvm/lib/Analysis/LoopAccessAnalysis.cpp4
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp4
3 files changed, 9 insertions, 8 deletions
diff --git a/llvm/include/llvm/Analysis/LoopAccessAnalysis.h b/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
index 937718b5408..a3dcb79ec34 100644
--- a/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
+++ b/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
@@ -38,10 +38,10 @@ class SCEV;
/// the user why vectorization did not occur.
class VectorizationReport {
std::string Message;
- Instruction *Instr;
+ const Instruction *Instr;
public:
- VectorizationReport(Instruction *I = nullptr)
+ VectorizationReport(const Instruction *I = nullptr)
: Message("loop not vectorized: "), Instr(I) {}
template <typename A> VectorizationReport &operator<<(const A &Value) {
@@ -50,15 +50,16 @@ public:
return *this;
}
- Instruction *getInstr() { return Instr; }
+ const Instruction *getInstr() const { return Instr; }
std::string &str() { return Message; }
+ const std::string &str() const { return Message; }
operator Twine() { return Message; }
/// \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(VectorizationReport &Message,
+ static void emitAnalysis(const VectorizationReport &Message,
const Function *TheFunction,
const Loop *TheLoop,
const char *PassName);
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index ba2f9b8e427..68f9ee1cb4e 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -25,12 +25,12 @@ using namespace llvm;
#define DEBUG_TYPE "loop-accesses"
-void VectorizationReport::emitAnalysis(VectorizationReport &Message,
+void VectorizationReport::emitAnalysis(const VectorizationReport &Message,
const Function *TheFunction,
const Loop *TheLoop,
const char *PassName) {
DebugLoc DL = TheLoop->getStartLoc();
- if (Instruction *I = Message.getInstr())
+ if (const Instruction *I = Message.getInstr())
DL = I->getDebugLoc();
emitOptimizationRemarkAnalysis(TheFunction->getContext(), PassName,
*TheFunction, DL, Message.str());
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index efbc746ef62..a6dbeed6bc8 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -836,7 +836,7 @@ private:
/// Report an analysis message to assist the user in diagnosing loops that are
/// not vectorized.
- void emitAnalysis(VectorizationReport &Message) {
+ void emitAnalysis(const VectorizationReport &Message) {
VectorizationReport::emitAnalysis(Message, TheFunction, TheLoop, LV_NAME);
}
@@ -973,7 +973,7 @@ private:
/// Report an analysis message to assist the user in diagnosing loops that are
/// not vectorized.
- void emitAnalysis(VectorizationReport &Message) {
+ void emitAnalysis(const VectorizationReport &Message) {
VectorizationReport::emitAnalysis(Message, TheFunction, TheLoop, LV_NAME);
}
OpenPOWER on IntegriCloud