std::string &str() { return Out.str(); }
operator Twine() { return Out.str(); }
+
+ /// \brief Emit an analysis note with the debug location from the instruction
+ /// in \p Message if available. Otherwise use the location of \p TheLoop.
+ static void emitAnalysis(Report &Message, const Function *TheFunction,
+ const Loop *TheLoop);
};
/// InnerLoopVectorizer vectorizes loops which contain only one basic
}
}
+void Report::emitAnalysis(Report &Message, const Function *TheFunction,
+ const Loop *TheLoop) {
+ DebugLoc DL = TheLoop->getStartLoc();
+ if (Instruction *I = Message.getInstr())
+ DL = I->getDebugLoc();
+ emitOptimizationRemarkAnalysis(TheFunction->getContext(), DEBUG_TYPE,
+ *TheFunction, DL, Message.str());
+}
+
/// \brief Propagate known metadata from one instruction to a vector of others.
static void propagateMetadata(SmallVectorImpl<Value *> &To, const Instruction *From) {
for (Value *V : To)
/// Report an analysis message to assist the user in diagnosing loops that are
/// not vectorized.
void emitAnalysis(Report &Message) {
- DebugLoc DL = TheLoop->getStartLoc();
- if (Instruction *I = Message.getInstr())
- DL = I->getDebugLoc();
- emitOptimizationRemarkAnalysis(TheFunction->getContext(), DEBUG_TYPE,
- *TheFunction, DL, Message.str());
+ Report::emitAnalysis(Message, TheFunction, TheLoop);
}
/// The loop that we evaluate.
/// Report an analysis message to assist the user in diagnosing loops that are
/// not vectorized.
void emitAnalysis(Report &Message) {
- DebugLoc DL = TheLoop->getStartLoc();
- if (Instruction *I = Message.getInstr())
- DL = I->getDebugLoc();
- emitOptimizationRemarkAnalysis(TheFunction->getContext(), DEBUG_TYPE,
- *TheFunction, DL, Message.str());
+ Report::emitAnalysis(Message, TheFunction, TheLoop);
}
/// Values used only by @llvm.assume calls.