[llvm] r282521 - [DebugInfo] Add comments to phi dbg.value tracking code, NFC

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 27 11:45:32 PDT 2016


Author: rnk
Date: Tue Sep 27 13:45:31 2016
New Revision: 282521

URL: http://llvm.org/viewvc/llvm-project?rev=282521&view=rev
Log:
[DebugInfo] Add comments to phi dbg.value tracking code, NFC

LLVM developers might be surprised to learn that there are blocks
without valid insertion points (catchswitch), so it seems worth calling
that out explicitly.  Also add a FIXME about what we should really be
doing if we ever need to make optimized Windows EH code debuggable.

While I'm here, make auto usage more consistent with LLVM standards and
avoid an unecessary call to insertBefore.

Modified:
    llvm/trunk/lib/Transforms/Utils/Local.cpp

Modified: llvm/trunk/lib/Transforms/Utils/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/Local.cpp?rev=282521&r1=282520&r2=282521&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/Local.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/Local.cpp Tue Sep 27 13:45:31 2016
@@ -1147,13 +1147,15 @@ void llvm::ConvertDebugDeclareToDebugVal
   if (PhiHasDebugValue(DIVar, DIExpr, APN))
     return;
 
-  auto BB = APN->getParent();
+  BasicBlock *BB = APN->getParent();
   auto InsertionPt = BB->getFirstInsertionPt();
-  if (InsertionPt != BB->end()) {
-    Instruction *DbgValue = Builder.insertDbgValueIntrinsic(
-        APN, 0, DIVar, DIExpr, DDI->getDebugLoc(), (Instruction *)nullptr);
-    DbgValue->insertBefore(&*InsertionPt);
-  }
+
+  // The block may be a catchswitch block, which does not have a valid
+  // insertion point.
+  // FIXME: Insert dbg.value markers in the successors when appropriate.
+  if (InsertionPt != BB->end())
+    Builder.insertDbgValueIntrinsic(APN, 0, DIVar, DIExpr, DDI->getDebugLoc(),
+                                    &*InsertionPt);
 }
 
 /// Determine whether this alloca is either a VLA or an array.




More information about the llvm-commits mailing list