[Assignment Tracking][SROA] Delete dbg.assigns linked to rewritten stores
authorOCHyams <orlando.hyams@sony.com>
Fri, 10 Feb 2023 09:26:26 +0000 (09:26 +0000)
committerOCHyams <orlando.hyams@sony.com>
Fri, 10 Feb 2023 09:57:05 +0000 (09:57 +0000)
AggLoadStoreRewriter splits aggregate loads and stores into scalars (before the
alloca is split up). The new stores and debug intrinsics are already wired up
correctly - we just need to also delete the dbg.assign that is linked to the
split to-be-deleted store too.

Reviewed By: jmorse

Differential Revision: https://reviews.llvm.org/D142882

llvm/lib/Transforms/Scalar/SROA.cpp
llvm/test/DebugInfo/Generic/assignment-tracking/sroa/complex.ll

index da277ff..379cc3e 100644 (file)
@@ -3579,6 +3579,9 @@ private:
                              getAdjustedAlignment(&SI, 0), DL, IRB);
     Splitter.emitSplitOps(V->getType(), V, V->getName() + ".fca");
     Visited.erase(&SI);
+    // The stores replacing SI each have markers describing fragments of the
+    // assignment so delete the assignment markers linked to SI.
+    at::deleteAssignmentMarkers(&SI);
     SI.eraseFromParent();
     return true;
   }
index d7cdbc3..d2bd109 100644 (file)
@@ -1,4 +1,5 @@
-; RUN: opt -passes=sroa -S -o - %s | FileCheck %s
+; RUN: opt -passes=sroa -S -o - %s \
+; RUN: | FileCheck %s --implicit-check-not="call void @llvm.dbg"
 ;
 ;; Based on llvm/test/DebugInfo/ARM/sroa-complex.ll
 ;; generated from: