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

Stephen Tozer via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 11 10:38:35 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:

Is the first condition in this assert meant to be inverted? I would have thought that if `Where == end()`, then `Where->getParent() == this` would be trivially true!

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


More information about the llvm-commits mailing list