[llvm] r229896 - [LoopAccesses] Add missing const to APIs in VectorizationReport
Adam Nemet
anemet at apple.com
Thu Feb 19 11:15:13 PST 2015
Author: anemet
Date: Thu Feb 19 13:15:13 2015
New Revision: 229896
URL: http://llvm.org/viewvc/llvm-project?rev=229896&view=rev
Log:
[LoopAccesses] Add missing const to APIs in VectorizationReport
When I split out LoopAccessReport from this, I need to create some temps
so constness becomes necessary.
This is part of the patchset that converts LoopAccessAnalysis into an
actual analysis pass.
Modified:
llvm/trunk/include/llvm/Analysis/LoopAccessAnalysis.h
llvm/trunk/lib/Analysis/LoopAccessAnalysis.cpp
llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
Modified: llvm/trunk/include/llvm/Analysis/LoopAccessAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopAccessAnalysis.h?rev=229896&r1=229895&r2=229896&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopAccessAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopAccessAnalysis.h Thu Feb 19 13:15:13 2015
@@ -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);
Modified: llvm/trunk/lib/Analysis/LoopAccessAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopAccessAnalysis.cpp?rev=229896&r1=229895&r2=229896&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoopAccessAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopAccessAnalysis.cpp Thu Feb 19 13:15:13 2015
@@ -50,12 +50,12 @@ bool VectorizerParams::isInterleaveForce
return ::VectorizationInterleave.getNumOccurrences() > 0;
}
-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());
Modified: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=229896&r1=229895&r2=229896&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp Thu Feb 19 13:15:13 2015
@@ -815,7 +815,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);
}
@@ -952,7 +952,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);
}
More information about the llvm-commits
mailing list