Reset the debug location even if the instruction was a terminator.
authorDan Gohman <gohman@apple.com>
Wed, 14 Apr 2010 19:30:02 +0000 (19:30 +0000)
committerDan Gohman <gohman@apple.com>
Wed, 14 Apr 2010 19:30:02 +0000 (19:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101272 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

index 5dd216bfaa8186a610a31d49d35b750d6dd34f98..71fbafe6f3185086ab2799be515a2623e8209114 100644 (file)
@@ -260,13 +260,11 @@ void SelectionDAGISel::SelectBasicBlock(BasicBlock *LLVMBB,
   for (BasicBlock::iterator I = Begin; I != End && !SDB->HasTailCall; ++I) {
     SetDebugLoc(I, SDB, 0, MF);
 
-    if (!isa<TerminatorInst>(I)) {
+    // Visit the instruction. Terminators are handled below.
+    if (!isa<TerminatorInst>(I))
       SDB->visit(*I);
 
-      // Set the current debug location back to "unknown" so that it doesn't
-      // spuriously apply to subsequent instructions.
-      ResetDebugLoc(SDB, 0);
-    }
+    ResetDebugLoc(SDB, 0);
   }
 
   if (!SDB->HasTailCall) {