summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
diff options
context:
space:
mode:
authorZinovy Nis <zinovy.nis@gmail.com>2014-05-20 08:26:20 +0000
committerZinovy Nis <zinovy.nis@gmail.com>2014-05-20 08:26:20 +0000
commitabdf44e7f38d392fed85692b2a31bf1578f3ee3b (patch)
tree5602cbf5ec7bcf33ddd82565df43ad96f42894c0 /llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
parentdb8c1cb02ca7f80fff87d3002569da8c18fa6cb0 (diff)
downloadbcm5719-llvm-abdf44e7f38d392fed85692b2a31bf1578f3ee3b.tar.gz
bcm5719-llvm-abdf44e7f38d392fed85692b2a31bf1578f3ee3b.zip
[LV][REFACTOR] One more tiny fix for printing debug locations in loop vectorizer. Now consistent with the remarks emitter.
Differential Revision: http://reviews.llvm.org/D3821 llvm-svn: 209197
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/LoopVectorize.cpp')
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 63548643b41..d57fae34dd6 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -477,18 +477,17 @@ static void setDebugLocFromInst(IRBuilder<> &B, const Value *Ptr) {
}
#ifndef NDEBUG
-/// \return string containing a file name and a line # for the given
-/// instruction.
-static std::string getDebugLocString(const Instruction *I) {
+/// \return string containing a file name and a line # for the given loop.
+static std::string getDebugLocString(const Loop *L) {
std::string Result;
- if (I) {
+ if (L) {
raw_string_ostream OS(Result);
- const DebugLoc &InstrDebugLoc = I->getDebugLoc();
- if (!InstrDebugLoc.isUnknown())
- InstrDebugLoc.print(I->getContext(), OS);
+ const DebugLoc LoopDbgLoc = L->getStartLoc();
+ if (!LoopDbgLoc.isUnknown())
+ LoopDbgLoc.print(L->getHeader()->getContext(), OS);
else
// Just print the module name.
- OS << I->getParent()->getParent()->getParent()->getModuleIdentifier();
+ OS << L->getHeader()->getParent()->getParent()->getModuleIdentifier();
OS.flush();
}
return Result;
@@ -1107,8 +1106,7 @@ struct LoopVectorize : public FunctionPass {
assert(L->empty() && "Only process inner loops.");
#ifndef NDEBUG
- const std::string DebugLocStr =
- getDebugLocString(L->getHeader()->getFirstNonPHIOrDbgOrLifetime());
+ const std::string DebugLocStr = getDebugLocString(L);
#endif /* NDEBUG */
DEBUG(dbgs() << "\nLV: Checking a loop in \""
OpenPOWER on IntegriCloud