[PATCH] D61008: [NFC][Utils] deleteDeadLoop(): add an assert that exit block has some non-PHI instruction

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 5 12:01:52 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL359993: [NFC][Utils] deleteDeadLoop(): add an assert that exit block has some non-PHI… (authored by lebedevri, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D61008?vs=196231&id=198189#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61008/new/

https://reviews.llvm.org/D61008

Files:
  llvm/trunk/lib/Transforms/Utils/LoopUtils.cpp


Index: llvm/trunk/lib/Transforms/Utils/LoopUtils.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Utils/LoopUtils.cpp
+++ llvm/trunk/lib/Transforms/Utils/LoopUtils.cpp
@@ -584,10 +584,14 @@
   // dbg.value truncates the range of any dbg.value before the loop where the
   // loop used to be. This is particularly important for constant values.
   DIBuilder DIB(*ExitBlock->getModule());
+  Instruction *InsertDbgValueBefore = ExitBlock->getFirstNonPHI();
+  assert(InsertDbgValueBefore &&
+         "There should be a non-PHI instruction in exit block, else these "
+         "instructions will have no parent.");
   for (auto *DVI : DeadDebugInst)
-    DIB.insertDbgValueIntrinsic(
-        UndefValue::get(Builder.getInt32Ty()), DVI->getVariable(),
-        DVI->getExpression(), DVI->getDebugLoc(), ExitBlock->getFirstNonPHI());
+    DIB.insertDbgValueIntrinsic(UndefValue::get(Builder.getInt32Ty()),
+                                DVI->getVariable(), DVI->getExpression(),
+                                DVI->getDebugLoc(), InsertDbgValueBefore);
 
   // Remove the block from the reference counting scheme, so that we can
   // delete it freely later.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61008.198189.patch
Type: text/x-patch
Size: 1214 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190505/81777c12/attachment.bin>


More information about the llvm-commits mailing list