[PATCH] D143153: [Assignment Tracking][mem2reg] Remove overly defensive assert

Orlando Cazalet-Hyams via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 2 01:09:32 PST 2023


Orlando created this revision.
Orlando added reviewers: jmorse, StephenTozer.
Orlando added a project: debug-info.
Herald added a subscriber: hiraditya.
Herald added a project: All.
Orlando requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The assert fires if a store to an alloca with no linked dbg.assigns has linked dbg.assigns. This can happen in the wild due to optimisations dropping the alloca's debug info so we shouldn't assert against it.


https://reviews.llvm.org/D143153

Files:
  llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp


Index: llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
===================================================================
--- llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
+++ llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
@@ -121,10 +121,8 @@
   void updateForDeletedStore(StoreInst *ToDelete, DIBuilder &DIB) const {
     // There's nothing to do if the alloca doesn't have any variables using
     // assignment tracking.
-    if (DbgAssigns.empty()) {
-      assert(at::getAssignmentMarkers(ToDelete).empty());
+    if (DbgAssigns.empty())
       return;
-    }
 
     // Just leave dbg.assign intrinsics in place and remember that we've seen
     // one for each variable fragment.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143153.494199.patch
Type: text/x-patch
Size: 709 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230202/f3044c78/attachment-0001.bin>


More information about the llvm-commits mailing list