[Assignment Tracking][SROA] Follow-up for failing test
authorOCHyams <orlando.hyams@sony.com>
Mon, 28 Nov 2022 11:59:14 +0000 (11:59 +0000)
committerOCHyams <orlando.hyams@sony.com>
Mon, 28 Nov 2022 12:16:37 +0000 (12:16 +0000)
Follow-up for D133296 / e16d59973ffec77eeef73409570bdf04a69c2405

Buildbot example: https://lab.llvm.org/buildbot/#/builders/6/builds/16989

llvm/lib/Transforms/Scalar/SROA.cpp

index fc56ea7..1158d78 100644 (file)
@@ -141,6 +141,11 @@ static void migrateDebugInfo(AllocaInst *OldAlloca,
                              uint64_t SliceSizeInBytes, Instruction *OldInst,
                              Instruction *Inst, Value *Dest, Value *Value,
                              const DataLayout &DL) {
+  auto MarkerRange = at::getAssignmentMarkers(OldInst);
+  // Nothing to do if OldInst has no linked dbg.assign intrinsics.
+  if (MarkerRange.empty())
+    return;
+
   uint64_t RelativeOffset = bytesToBits(RelativeOffsetInBytes);
   uint64_t SliceSize = bytesToBits(SliceSizeInBytes);
 
@@ -162,8 +167,7 @@ static void migrateDebugInfo(AllocaInst *OldAlloca,
   DIBuilder DIB(*OldInst->getModule(), /*AllowUnresolved*/ false);
   uint64_t AllocaSize = *OldAlloca->getAllocationSizeInBits(DL);
   assert(OldAlloca->isStaticAlloca());
-
-  for (DbgAssignIntrinsic *DbgAssign : at::getAssignmentMarkers(OldInst)) {
+  for (DbgAssignIntrinsic *DbgAssign : MarkerRange) {
     LLVM_DEBUG(dbgs() << "      existing dbg.assign is: " << *DbgAssign
                       << "\n");
     auto *Expr = DbgAssign->getExpression();