/// 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) {
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);
#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());
/// 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);
}
/// 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);
}