[llvm] [RemoveDIs] Update DIBuilder to conditionally insert DbgRecords (PR #84739)

Stephen Tozer via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 12 02:48:09 PDT 2024


================
@@ -1038,15 +1036,10 @@ void BasicBlock::insertDPValueAfter(DbgRecord *DPV, Instruction *I) {
 
 void BasicBlock::insertDPValueBefore(DbgRecord *DPV,
                                      InstListType::iterator Where) {
-  // We should never directly insert at the end of the block, new DPValues
-  // shouldn't be generated at times when there's no terminator.
-  assert(Where != end());
-  assert(Where->getParent() == this);
-  if (!Where->DbgMarker)
-    createMarker(Where);
+  assert(Where == end() || Where->getParent() == this);
----------------
SLTozer wrote:

Ah, so this is changing the condition here to account for insertions at `end()` (as for the OpenMP test above), while also preventing the error you just described. Got it!

https://github.com/llvm/llvm-project/pull/84739


More information about the llvm-commits mailing list