[llvm] r209197 - [LV][REFACTOR] One more tiny fix for printing debug locations in loop vectorizer. Now consistent with the remarks emitter.

Zinovy Nis zinovy.nis at gmail.com
Tue May 20 01:26:22 PDT 2014


Author: zinovy.nis
Date: Tue May 20 03:26:20 2014
New Revision: 209197

URL: http://llvm.org/viewvc/llvm-project?rev=209197&view=rev
Log:
[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


Modified:
    llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp

Modified: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=209197&r1=209196&r2=209197&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp Tue May 20 03:26:20 2014
@@ -477,18 +477,17 @@ static void setDebugLocFromInst(IRBuilde
 }
 
 #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 FunctionPa
     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 \""





More information about the llvm-commits mailing list