[llvm] [DebugInfo][RemoveDIs] Make debugify pass convert to/from RemoveDIs mode (PR #73251)

Jeremy Morse via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 23 08:18:57 PST 2023


https://github.com/jmorse updated https://github.com/llvm/llvm-project/pull/73251

>From aa96d6a3b2b824fca3b1030837c444d2af74db0d Mon Sep 17 00:00:00 2001
From: Jeremy Morse <jeremy.morse at sony.com>
Date: Thu, 23 Nov 2023 15:17:28 +0000
Subject: [PATCH 1/2] [DebugInfo][RemoveDIs] Make debugify pass convert to/from
 RemoveDIs mode

Debugify is extremely useful as a testing and debugging tool, and a good
number of LLVM-IR transform tests use it. We need it to support "new"
non-instruction debug-info to get test coverage, but it's not important
enough to completely convert right now (and it'd be a large undertaking).
Thus: convert to/from dbg.value/DPValue mode on entry and exit of the pass,
which gives us the functionality without any further work. The cost is
compile-time, but again this is only happening during tests.

Tested by: the large set of debugify tests enabled here. Note the
InstCombine test (cast-mul-select.ll) that hasn't been fully enabled: this
is because there's a debug-info sinking piece of code there that hasn't
been instrumented.
---
 llvm/lib/Transforms/Utils/Debugify.cpp        | 65 +++++++++++++++++--
 .../Transforms/ArgumentPromotion/pr27568.ll   |  1 +
 llvm/test/Transforms/BDCE/basic.ll            |  1 +
 llvm/test/Transforms/DCE/basic.ll             |  1 +
 .../DeadStoreElimination/debuginfo.ll         |  1 +
 .../shrink-global-to-bool-check-debug.ll      |  1 +
 .../test/Transforms/InstCombine/call-guard.ll |  1 +
 .../Transforms/InstCombine/cast-mul-select.ll |  4 ++
 .../InstCombine/debuginfo-variables.ll        |  1 +
 .../InstCombine/double-float-shrink-2.ll      |  1 +
 .../Transforms/InstCombine/storemerge-dbg.ll  |  1 +
 .../JumpThreading/branch-debug-info.ll        |  1 +
 .../LCSSA/avoid-intrinsics-in-catchswitch.ll  |  1 +
 llvm/test/Transforms/LCSSA/basictest.ll       |  1 +
 llvm/test/Transforms/LICM/sinking-debugify.ll |  1 +
 .../X86/arithmetic-right-shift-until-zero.ll  |  1 +
 .../LoopIdiom/X86/left-shift-until-bittest.ll |  1 +
 ...ogical-right-shift-until-zero-debuginfo.ll |  1 +
 .../LoopIdiom/memcpy-debugify-remarks.ll      |  3 +
 .../LoopIdiom/memset-debugify-remarks.ll      |  3 +
 .../Transforms/LoopUnroll/X86/call-remark.ll  |  2 +
 .../Transforms/LoopVectorize/i8-induction.ll  |  1 +
 .../preserve-dbg-loc-and-loop-metadata.ll     |  1 +
 .../Mem2Reg/PromoteMemToRegister.ll           |  1 +
 llvm/test/Transforms/MemCpyOpt/pr37967.ll     |  1 +
 .../st_sink_check_debug.ll                    |  2 +-
 llvm/test/Transforms/SCCP/ipsccp-basic.ll     |  1 +
 llvm/test/Transforms/SCCP/loadtest.ll         |  2 +
 llvm/test/Transforms/SROA/alignment.ll        |  1 +
 ...patible-invokes-of-landingpad-debuginfo.ll |  1 +
 .../SimplifyCFG/debug-info-thread-phi.ll      |  1 +
 llvm/test/Transforms/TailCallElim/debugloc.ll |  1 +
 .../test/Transforms/Util/Debugify/loc-only.ll |  2 +
 33 files changed, 101 insertions(+), 7 deletions(-)

diff --git a/llvm/lib/Transforms/Utils/Debugify.cpp b/llvm/lib/Transforms/Utils/Debugify.cpp
index 9f210bc7e8b4e81..2a7e93139c41d2f 100644
--- a/llvm/lib/Transforms/Utils/Debugify.cpp
+++ b/llvm/lib/Transforms/Utils/Debugify.cpp
@@ -801,7 +801,15 @@ bool checkDebugifyMetadata(Module &M,
 /// legacy module pass manager.
 struct DebugifyModulePass : public ModulePass {
   bool runOnModule(Module &M) override {
-    return applyDebugify(M, Mode, DebugInfoBeforePass, NameOfWrappedPass);
+    bool OldDebugMode = M.IsNewDbgInfoFormat;
+    if (OldDebugMode)
+      M.convertFromNewDbgValues();
+
+    bool Result = applyDebugify(M, Mode, DebugInfoBeforePass, NameOfWrappedPass);
+
+    if (OldDebugMode)
+      M.convertToNewDbgValues();
+    return Result;
   }
 
   DebugifyModulePass(enum DebugifyMode Mode = DebugifyMode::SyntheticDebugInfo,
@@ -826,7 +834,15 @@ struct DebugifyModulePass : public ModulePass {
 /// single function, used with the legacy module pass manager.
 struct DebugifyFunctionPass : public FunctionPass {
   bool runOnFunction(Function &F) override {
-    return applyDebugify(F, Mode, DebugInfoBeforePass, NameOfWrappedPass);
+    bool OldDebugMode = F.IsNewDbgInfoFormat;
+    if (OldDebugMode)
+      F.convertFromNewDbgValues();
+
+    bool Result = applyDebugify(F, Mode, DebugInfoBeforePass, NameOfWrappedPass);
+
+    if (OldDebugMode)
+      F.convertToNewDbgValues();
+    return Result;
   }
 
   DebugifyFunctionPass(
@@ -852,13 +868,24 @@ struct DebugifyFunctionPass : public FunctionPass {
 /// legacy module pass manager.
 struct CheckDebugifyModulePass : public ModulePass {
   bool runOnModule(Module &M) override {
+    bool OldDebugMode = M.IsNewDbgInfoFormat;
+    if (OldDebugMode)
+      M.convertFromNewDbgValues();
+
+    bool Result;
     if (Mode == DebugifyMode::SyntheticDebugInfo)
-      return checkDebugifyMetadata(M, M.functions(), NameOfWrappedPass,
+      Result = checkDebugifyMetadata(M, M.functions(), NameOfWrappedPass,
                                    "CheckModuleDebugify", Strip, StatsMap);
-    return checkDebugInfoMetadata(
+    else
+      Result = checkDebugInfoMetadata(
         M, M.functions(), *DebugInfoBeforePass,
         "CheckModuleDebugify (original debuginfo)", NameOfWrappedPass,
         OrigDIVerifyBugsReportFilePath);
+
+    if (OldDebugMode)
+      M.convertToNewDbgValues();
+
+    return Result;
   }
 
   CheckDebugifyModulePass(
@@ -891,16 +918,26 @@ struct CheckDebugifyModulePass : public ModulePass {
 /// with the legacy module pass manager.
 struct CheckDebugifyFunctionPass : public FunctionPass {
   bool runOnFunction(Function &F) override {
+    bool OldDebugMode = F.IsNewDbgInfoFormat;
+    if (OldDebugMode)
+      F.convertFromNewDbgValues();
+
     Module &M = *F.getParent();
     auto FuncIt = F.getIterator();
+    bool Result;
     if (Mode == DebugifyMode::SyntheticDebugInfo)
-      return checkDebugifyMetadata(M, make_range(FuncIt, std::next(FuncIt)),
+      Result = checkDebugifyMetadata(M, make_range(FuncIt, std::next(FuncIt)),
                                    NameOfWrappedPass, "CheckFunctionDebugify",
                                    Strip, StatsMap);
-    return checkDebugInfoMetadata(
+    else
+      Result = checkDebugInfoMetadata(
         M, make_range(FuncIt, std::next(FuncIt)), *DebugInfoBeforePass,
         "CheckFunctionDebugify (original debuginfo)", NameOfWrappedPass,
         OrigDIVerifyBugsReportFilePath);
+
+    if (OldDebugMode)
+      F.convertToNewDbgValues();
+    return Result;
   }
 
   CheckDebugifyFunctionPass(
@@ -972,6 +1009,10 @@ createDebugifyFunctionPass(enum DebugifyMode Mode,
 }
 
 PreservedAnalyses NewPMDebugifyPass::run(Module &M, ModuleAnalysisManager &) {
+  bool OldDebugMode = M.IsNewDbgInfoFormat;
+  if (OldDebugMode)
+    M.convertFromNewDbgValues();
+
   if (Mode == DebugifyMode::SyntheticDebugInfo)
     applyDebugifyMetadata(M, M.functions(),
                           "ModuleDebugify: ", /*ApplyToMF*/ nullptr);
@@ -979,6 +1020,10 @@ PreservedAnalyses NewPMDebugifyPass::run(Module &M, ModuleAnalysisManager &) {
     collectDebugInfoMetadata(M, M.functions(), *DebugInfoBeforePass,
                              "ModuleDebugify (original debuginfo)",
                               NameOfWrappedPass);
+
+  if (OldDebugMode)
+      M.convertToNewDbgValues();
+
   PreservedAnalyses PA;
   PA.preserveSet<CFGAnalyses>();
   return PA;
@@ -1010,6 +1055,10 @@ FunctionPass *createCheckDebugifyFunctionPass(
 
 PreservedAnalyses NewPMCheckDebugifyPass::run(Module &M,
                                               ModuleAnalysisManager &) {
+  bool OldDebugMode = M.IsNewDbgInfoFormat;
+  if (OldDebugMode)
+    M.convertFromNewDbgValues();
+
   if (Mode == DebugifyMode::SyntheticDebugInfo)
     checkDebugifyMetadata(M, M.functions(), NameOfWrappedPass,
                                    "CheckModuleDebugify", Strip, StatsMap);
@@ -1018,6 +1067,10 @@ PreservedAnalyses NewPMCheckDebugifyPass::run(Module &M,
       M, M.functions(), *DebugInfoBeforePass,
       "CheckModuleDebugify (original debuginfo)", NameOfWrappedPass,
       OrigDIVerifyBugsReportFilePath);
+
+  if (OldDebugMode)
+    M.convertToNewDbgValues();
+
   return PreservedAnalyses::all();
 }
 
diff --git a/llvm/test/Transforms/ArgumentPromotion/pr27568.ll b/llvm/test/Transforms/ArgumentPromotion/pr27568.ll
index 0e54c0099499ed9..cc25088edf52f9a 100644
--- a/llvm/test/Transforms/ArgumentPromotion/pr27568.ll
+++ b/llvm/test/Transforms/ArgumentPromotion/pr27568.ll
@@ -1,6 +1,7 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes
 ; RUN: opt -S -passes=argpromotion < %s | FileCheck %s
 ; RUN: opt -S -passes=debugify -o /dev/null < %s
+; RUN: opt -S -passes=debugify -o /dev/null < %s --try-experimental-debuginfo-iterators
 target triple = "x86_64-pc-windows-msvc"
 
 define internal void @callee(ptr) {
diff --git a/llvm/test/Transforms/BDCE/basic.ll b/llvm/test/Transforms/BDCE/basic.ll
index 73a235527fdec2d..ef0b7be2da0dcc2 100644
--- a/llvm/test/Transforms/BDCE/basic.ll
+++ b/llvm/test/Transforms/BDCE/basic.ll
@@ -1,6 +1,7 @@
 ; RUN: opt -S -passes='bdce,instsimplify' < %s | FileCheck %s
 ; RUN: opt -S -passes=instsimplify < %s | FileCheck %s -check-prefix=CHECK-IO
 ; RUN: opt -S -passes='debugify,bdce' < %s | FileCheck %s -check-prefix=DEBUGIFY
+; RUN: opt -S -passes='debugify,bdce' < %s --try-experimental-debuginfo-iterators | FileCheck %s -check-prefix=DEBUGIFY
 target datalayout = "E-m:e-i64:64-n32:64"
 target triple = "powerpc64-unknown-linux-gnu"
 
diff --git a/llvm/test/Transforms/DCE/basic.ll b/llvm/test/Transforms/DCE/basic.ll
index 1d97cda754a1cf8..154fde0d2e3606b 100644
--- a/llvm/test/Transforms/DCE/basic.ll
+++ b/llvm/test/Transforms/DCE/basic.ll
@@ -1,4 +1,5 @@
 ; RUN: opt -passes='module(debugify),function(dce)' -S < %s | FileCheck %s
+; RUN: opt -passes='module(debugify),function(dce)' -S < %s --try-experimental-debuginfo-iterators | FileCheck %s
 
 ; CHECK-LABEL: @test
 define void @test() {
diff --git a/llvm/test/Transforms/DeadStoreElimination/debuginfo.ll b/llvm/test/Transforms/DeadStoreElimination/debuginfo.ll
index 44f7b1111f594cd..0ad495ed0353b8d 100644
--- a/llvm/test/Transforms/DeadStoreElimination/debuginfo.ll
+++ b/llvm/test/Transforms/DeadStoreElimination/debuginfo.ll
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -passes=debugify,dse -S | FileCheck %s
+; RUN: opt < %s -passes=debugify,dse -S --try-experimental-debuginfo-iterators | FileCheck %s
 
 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
 
diff --git a/llvm/test/Transforms/GlobalOpt/shrink-global-to-bool-check-debug.ll b/llvm/test/Transforms/GlobalOpt/shrink-global-to-bool-check-debug.ll
index e453857a2586339..00de0f53a4e63f6 100644
--- a/llvm/test/Transforms/GlobalOpt/shrink-global-to-bool-check-debug.ll
+++ b/llvm/test/Transforms/GlobalOpt/shrink-global-to-bool-check-debug.ll
@@ -1,4 +1,5 @@
 ; RUN: opt -S -passes=debugify,globalopt -f %s | FileCheck %s
+; RUN: opt -S -passes=debugify,globalopt -f %s --try-experimental-debuginfo-iterators | FileCheck %s
 
 @foo = internal global i32 0, align 4
 
diff --git a/llvm/test/Transforms/InstCombine/call-guard.ll b/llvm/test/Transforms/InstCombine/call-guard.ll
index f746d450f3515e3..6d9308bbbd81593 100644
--- a/llvm/test/Transforms/InstCombine/call-guard.ll
+++ b/llvm/test/Transforms/InstCombine/call-guard.ll
@@ -1,6 +1,7 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ; RUN: opt < %s -passes=instcombine -S | FileCheck %s
 ; RUN: opt < %s -passes=instcombine -S -debugify-each | FileCheck %s
+; RUN: opt < %s -passes=instcombine -S -debugify-each --try-experimental-debuginfo-iterators | FileCheck %s
 
 declare void @llvm.experimental.guard(i1, ...)
 
diff --git a/llvm/test/Transforms/InstCombine/cast-mul-select.ll b/llvm/test/Transforms/InstCombine/cast-mul-select.ll
index 454522b85a1e843..1dd5066856ed5e4 100644
--- a/llvm/test/Transforms/InstCombine/cast-mul-select.ll
+++ b/llvm/test/Transforms/InstCombine/cast-mul-select.ll
@@ -2,6 +2,10 @@
 ; RUN: opt < %s -passes=instcombine -S | FileCheck %s
 ; RUN: opt -passes=debugify,instcombine -S < %s | FileCheck %s -check-prefix DBGINFO
 
+; FIXME RemoveDIs project: instcombine instruction sinking, and the
+; corresponding debug-info updates that are required, are not yet implemented.
+; run: opt -passes=debugify,instcombine -S < %s --try-experimental-debuginfo-iterators | FileCheck %s -check-prefix DBGINFO
+
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32"
 
 define i32 @mul(i32 %x, i32 %y) {
diff --git a/llvm/test/Transforms/InstCombine/debuginfo-variables.ll b/llvm/test/Transforms/InstCombine/debuginfo-variables.ll
index 2c62694cbe34990..546433fc6779ddb 100644
--- a/llvm/test/Transforms/InstCombine/debuginfo-variables.ll
+++ b/llvm/test/Transforms/InstCombine/debuginfo-variables.ll
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -passes=debugify,instcombine -S | FileCheck %s
+; RUN: opt < %s -passes=debugify,instcombine -S --try-experimental-debuginfo-iterators | FileCheck %s
 
 declare void @escape32(i32)
 
diff --git a/llvm/test/Transforms/InstCombine/double-float-shrink-2.ll b/llvm/test/Transforms/InstCombine/double-float-shrink-2.ll
index f2049e2813ebc39..482f6978003e310 100644
--- a/llvm/test/Transforms/InstCombine/double-float-shrink-2.ll
+++ b/llvm/test/Transforms/InstCombine/double-float-shrink-2.ll
@@ -7,6 +7,7 @@
 ; RUN: opt < %s -passes=instcombine -S -mtriple "x86_64-pc-mingw32" | FileCheck %s --check-prefixes=CHECK,DOUBLE-8BYTE-ALIGN
 ; RUN: opt < %s -passes=instcombine -S -mtriple "sparc-sun-solaris" | FileCheck %s --check-prefixes=CHECK,DOUBLE-8BYTE-ALIGN
 ; RUN: opt < %s -passes=instcombine -S -mtriple "x86_64-pc-win32" -enable-debugify 2>&1 | FileCheck --check-prefix=DBG-VALID %s
+; RUN: opt < %s -passes=instcombine -S -mtriple "x86_64-pc-win32" -enable-debugify 2>&1 --try-experimental-debuginfo-iterators | FileCheck --check-prefix=DBG-VALID %s
 
 declare double @floor(double)
 declare double @ceil(double)
diff --git a/llvm/test/Transforms/InstCombine/storemerge-dbg.ll b/llvm/test/Transforms/InstCombine/storemerge-dbg.ll
index bb1d616c312a3f5..f2bdf4493fbafb3 100644
--- a/llvm/test/Transforms/InstCombine/storemerge-dbg.ll
+++ b/llvm/test/Transforms/InstCombine/storemerge-dbg.ll
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -passes=debugify,instcombine -S | FileCheck %s
+; RUN: opt < %s -passes=debugify,instcombine -S --try-experimental-debuginfo-iterators | FileCheck %s
 
 declare i32 @escape(i32)
 
diff --git a/llvm/test/Transforms/JumpThreading/branch-debug-info.ll b/llvm/test/Transforms/JumpThreading/branch-debug-info.ll
index ac2bf337fd8601f..8eead1324cb6913 100644
--- a/llvm/test/Transforms/JumpThreading/branch-debug-info.ll
+++ b/llvm/test/Transforms/JumpThreading/branch-debug-info.ll
@@ -1,4 +1,5 @@
 ; RUN: opt -S -passes=debugify,jump-threading < %s | FileCheck %s
+; RUN: opt -S -passes=debugify,jump-threading < %s --try-experimental-debuginfo-iterators | FileCheck %s
 ; Tests Bug 37966
 
 define void @test0(i32 %i) {
diff --git a/llvm/test/Transforms/LCSSA/avoid-intrinsics-in-catchswitch.ll b/llvm/test/Transforms/LCSSA/avoid-intrinsics-in-catchswitch.ll
index fc0b59d182a0c47..2dd9ceb26cbd5f7 100644
--- a/llvm/test/Transforms/LCSSA/avoid-intrinsics-in-catchswitch.ll
+++ b/llvm/test/Transforms/LCSSA/avoid-intrinsics-in-catchswitch.ll
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -passes='debugify,function(loop-mssa(licm))'  -S -o /dev/null
+; RUN: opt < %s -passes='debugify,function(loop-mssa(licm))'  -S -o /dev/null --try-experimental-debuginfo-iterators
 ;
 ; The following test is from https://bugs.llvm.org/show_bug.cgi?id=36238
 ; This test should pass (not assert or fault). The error that originally
diff --git a/llvm/test/Transforms/LCSSA/basictest.ll b/llvm/test/Transforms/LCSSA/basictest.ll
index 750a32e17186bf2..fd9f086cd1ca546 100644
--- a/llvm/test/Transforms/LCSSA/basictest.ll
+++ b/llvm/test/Transforms/LCSSA/basictest.ll
@@ -1,5 +1,6 @@
 ; RUN: opt < %s -passes=lcssa -S | FileCheck %s
 ; RUN: opt < %s -passes=debugify,lcssa -S | FileCheck -check-prefix=DEBUGIFY %s
+; RUN: opt < %s -passes=debugify,lcssa -S --try-experimental-debuginfo-iterators | FileCheck -check-prefix=DEBUGIFY %s
 
 define void @lcssa(i1 %S2) {
 ; CHECK-LABEL: @lcssa
diff --git a/llvm/test/Transforms/LICM/sinking-debugify.ll b/llvm/test/Transforms/LICM/sinking-debugify.ll
index c8918bcee7dcb0e..75bed63f2aecfc5 100644
--- a/llvm/test/Transforms/LICM/sinking-debugify.ll
+++ b/llvm/test/Transforms/LICM/sinking-debugify.ll
@@ -1,5 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ; RUN: opt < %s -passes='debugify,function(loop-mssa(licm))' -S | FileCheck %s
+; RUN: opt < %s -passes='debugify,function(loop-mssa(licm))' -S --try-experimental-debuginfo-iterators | FileCheck %s
 
 %Ty = type { i32, i32 }
 @X2 = external global %Ty
diff --git a/llvm/test/Transforms/LoopIdiom/X86/arithmetic-right-shift-until-zero.ll b/llvm/test/Transforms/LoopIdiom/X86/arithmetic-right-shift-until-zero.ll
index 52c8294998397bb..e862823f8c4c9eb 100644
--- a/llvm/test/Transforms/LoopIdiom/X86/arithmetic-right-shift-until-zero.ll
+++ b/llvm/test/Transforms/LoopIdiom/X86/arithmetic-right-shift-until-zero.ll
@@ -1,6 +1,7 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ; RUN: opt -passes=debugify,loop-idiom -mtriple=x86_64 -mcpu=corei7 < %s -S | FileCheck --check-prefixes=CHECK,NOLZCNT %s
 ; RUN: opt -passes=debugify,loop-idiom -mtriple=x86_64 -mcpu=core-avx2 < %s -S | FileCheck --check-prefixes=CHECK,LZCNT %s
+; RUN: opt -passes=debugify,loop-idiom -mtriple=x86_64 -mcpu=corei7 < %s -S --try-experimental-debuginfo-iterators | FileCheck --check-prefixes=CHECK,NOLZCNT %s
 
 declare void @escape_inner(i8, i8, i8, i1, i8)
 declare void @escape_outer(i8, i8, i8, i1, i8)
diff --git a/llvm/test/Transforms/LoopIdiom/X86/left-shift-until-bittest.ll b/llvm/test/Transforms/LoopIdiom/X86/left-shift-until-bittest.ll
index b372195ee32eec6..734d3bf03911500 100644
--- a/llvm/test/Transforms/LoopIdiom/X86/left-shift-until-bittest.ll
+++ b/llvm/test/Transforms/LoopIdiom/X86/left-shift-until-bittest.ll
@@ -1,6 +1,7 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ; RUN: opt -passes=debugify,loop-idiom -mtriple=x86_64 -mcpu=core-avx2 < %s -S | FileCheck --check-prefixes=ALL,LZCNT %s
 ; RUN: opt -passes=debugify,loop-idiom -mtriple=x86_64 -mcpu=corei7 < %s -S | FileCheck  --check-prefixes=ALL,NOLZCNT %s
+; RUN: opt -passes=debugify,loop-idiom -mtriple=x86_64 -mcpu=core-avx2 < %s -S --try-experimental-debuginfo-iterators | FileCheck --check-prefixes=ALL,LZCNT %s
 
 declare i32 @gen32()
 declare void @use32(i32)
diff --git a/llvm/test/Transforms/LoopIdiom/X86/logical-right-shift-until-zero-debuginfo.ll b/llvm/test/Transforms/LoopIdiom/X86/logical-right-shift-until-zero-debuginfo.ll
index c39f146c959d0d7..3c0c53c8773c348 100644
--- a/llvm/test/Transforms/LoopIdiom/X86/logical-right-shift-until-zero-debuginfo.ll
+++ b/llvm/test/Transforms/LoopIdiom/X86/logical-right-shift-until-zero-debuginfo.ll
@@ -1,6 +1,7 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ; RUN: opt -passes=debugify,loop-idiom -mtriple=x86_64 -mcpu=corei7 < %s -S | FileCheck %s --check-prefixes=NOLZCNT
 ; RUN: opt -passes=debugify,loop-idiom -mtriple=x86_64 -mcpu=core-avx2 < %s -S | FileCheck %s --check-prefixes=LZCNT
+; RUN: opt -passes=debugify,loop-idiom -mtriple=x86_64 -mcpu=corei7 < %s -S --try-experimental-debuginfo-iterators | FileCheck %s --check-prefixes=NOLZCNT
 
 declare void @escape_inner(i8, i8, i8, i1, i8)
 declare void @escape_outer(i8, i8, i8, i1, i8)
diff --git a/llvm/test/Transforms/LoopIdiom/memcpy-debugify-remarks.ll b/llvm/test/Transforms/LoopIdiom/memcpy-debugify-remarks.ll
index 264f34dd044af3c..3a48b178123c472 100644
--- a/llvm/test/Transforms/LoopIdiom/memcpy-debugify-remarks.ll
+++ b/llvm/test/Transforms/LoopIdiom/memcpy-debugify-remarks.ll
@@ -2,6 +2,9 @@
 ; RUN: opt -passes=debugify,loop-idiom,verify -pass-remarks=loop-idiom -pass-remarks-analysis=loop-idiom -pass-remarks-output=%t.yaml -verify-each -verify-dom-info -verify-loop-info  < %s -S 2>&1 | FileCheck %s
 ; RUN: FileCheck --input-file=%t.yaml %s --check-prefixes=YAML
 
+; RUN: opt -passes=debugify,loop-idiom,verify -pass-remarks=loop-idiom -pass-remarks-analysis=loop-idiom -pass-remarks-output=%t.yaml -verify-each -verify-dom-info -verify-loop-info  < %s -S 2>&1 --try-experimental-debuginfo-iterators | FileCheck %s
+; RUN: FileCheck --input-file=%t.yaml %s --check-prefixes=YAML
+
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
diff --git a/llvm/test/Transforms/LoopIdiom/memset-debugify-remarks.ll b/llvm/test/Transforms/LoopIdiom/memset-debugify-remarks.ll
index 7ff6446fb47704b..62c56d17c3bacac 100644
--- a/llvm/test/Transforms/LoopIdiom/memset-debugify-remarks.ll
+++ b/llvm/test/Transforms/LoopIdiom/memset-debugify-remarks.ll
@@ -2,6 +2,9 @@
 ; RUN: opt -passes=debugify,loop-idiom,verify -pass-remarks=loop-idiom -pass-remarks-analysis=loop-idiom -pass-remarks-output=%t.yaml -verify-each -verify-dom-info -verify-loop-info  < %s -S 2>&1 | FileCheck %s
 ; RUN: FileCheck --input-file=%t.yaml %s --check-prefixes=YAML
 
+; RUN: opt -passes=debugify,loop-idiom,verify -pass-remarks=loop-idiom -pass-remarks-analysis=loop-idiom -pass-remarks-output=%t.yaml -verify-each -verify-dom-info -verify-loop-info  < %s -S 2>&1 --try-experimental-debuginfo-iterators | FileCheck %s
+; RUN: FileCheck --input-file=%t.yaml %s --check-prefixes=YAML
+
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
diff --git a/llvm/test/Transforms/LoopUnroll/X86/call-remark.ll b/llvm/test/Transforms/LoopUnroll/X86/call-remark.ll
index d34acc8f716131f..abdcfcf7e0742e2 100644
--- a/llvm/test/Transforms/LoopUnroll/X86/call-remark.ll
+++ b/llvm/test/Transforms/LoopUnroll/X86/call-remark.ll
@@ -2,6 +2,8 @@
 ; RUN: opt -passes=debugify,loop-unroll -mcpu=znver3 -pass-remarks=TTI -pass-remarks-analysis=TTI  < %s -S 2>&1 | FileCheck --check-prefixes=ALL,TTI %s
 ; RUN: opt -passes=debugify,loop-unroll -mcpu=znver4 -pass-remarks=loop-unroll -pass-remarks-analysis=loop-unroll < %s -S 2>&1 | FileCheck --check-prefixes=ALL,UNROLL %s
 
+; RUN: opt -passes=debugify,loop-unroll -mcpu=znver3 -pass-remarks=loop-unroll -pass-remarks-analysis=loop-unroll < %s -S 2>&1 --try-experimental-debuginfo-iterators | FileCheck --check-prefixes=ALL,UNROLL %s
+
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
diff --git a/llvm/test/Transforms/LoopVectorize/i8-induction.ll b/llvm/test/Transforms/LoopVectorize/i8-induction.ll
index 220fd64e6a8292d..74b630ca150fe45 100644
--- a/llvm/test/Transforms/LoopVectorize/i8-induction.ll
+++ b/llvm/test/Transforms/LoopVectorize/i8-induction.ll
@@ -1,5 +1,6 @@
 ; RUN: opt < %s -passes=loop-vectorize,dce,instcombine -force-vector-interleave=1 -force-vector-width=4 -S
 ; RUN: opt < %s -passes=debugify,loop-vectorize -S | FileCheck %s --check-prefix=DEBUGLOC
+; RUN: opt < %s -passes=debugify,loop-vectorize -S --try-experimental-debuginfo-iterators | FileCheck %s --check-prefix=DEBUGLOC
 
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
 
diff --git a/llvm/test/Transforms/LoopVectorize/preserve-dbg-loc-and-loop-metadata.ll b/llvm/test/Transforms/LoopVectorize/preserve-dbg-loc-and-loop-metadata.ll
index 8cd15daa83e6cd5..9cb9a2e93d0a9ea 100644
--- a/llvm/test/Transforms/LoopVectorize/preserve-dbg-loc-and-loop-metadata.ll
+++ b/llvm/test/Transforms/LoopVectorize/preserve-dbg-loc-and-loop-metadata.ll
@@ -1,5 +1,6 @@
 ; RUN: opt < %s -passes=loop-vectorize -S 2>&1 | FileCheck %s
 ; RUN: opt < %s -passes=debugify,loop-vectorize -S | FileCheck %s -check-prefix DEBUGLOC
+; RUN: opt < %s -passes=debugify,loop-vectorize -S --try-experimental-debuginfo-iterators | FileCheck %s -check-prefix DEBUGLOC
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 
 ; This test makes sure we don't duplicate the loop vectorizer's metadata
diff --git a/llvm/test/Transforms/Mem2Reg/PromoteMemToRegister.ll b/llvm/test/Transforms/Mem2Reg/PromoteMemToRegister.ll
index f8c838c9d4393ac..d81cfd3e18837a9 100644
--- a/llvm/test/Transforms/Mem2Reg/PromoteMemToRegister.ll
+++ b/llvm/test/Transforms/Mem2Reg/PromoteMemToRegister.ll
@@ -1,5 +1,6 @@
 ; Simple basic correctness check testcase.  Both alloca's should be eliminated.
 ; RUN: opt < %s -passes='debugify,mem2reg,check-debugify' -S 2>&1 | FileCheck %s
+; RUN: opt < %s -passes='debugify,mem2reg,check-debugify' -S 2>&1 --try-experimental-debuginfo-iterators | FileCheck %s
 
 ; CHECK-NOT: alloca
 ; CHECK: CheckModuleDebugify: PASS
diff --git a/llvm/test/Transforms/MemCpyOpt/pr37967.ll b/llvm/test/Transforms/MemCpyOpt/pr37967.ll
index 31b0b0c0a471c0f..3731345b022242b 100644
--- a/llvm/test/Transforms/MemCpyOpt/pr37967.ll
+++ b/llvm/test/Transforms/MemCpyOpt/pr37967.ll
@@ -1,5 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ; RUN: opt -passes='debugify,memcpyopt,check-debugify' -S < %s 2>&1 -verify-memoryssa | FileCheck %s
+; RUN: opt -passes='debugify,memcpyopt,check-debugify' -S < %s 2>&1 -verify-memoryssa --try-experimental-debuginfo-iterators | FileCheck %s
 
 ; CHECK: CheckModuleDebugify: PASS
 
diff --git a/llvm/test/Transforms/MergedLoadStoreMotion/st_sink_check_debug.ll b/llvm/test/Transforms/MergedLoadStoreMotion/st_sink_check_debug.ll
index 80696b6c4241ddd..351a65a013aec4e 100644
--- a/llvm/test/Transforms/MergedLoadStoreMotion/st_sink_check_debug.ll
+++ b/llvm/test/Transforms/MergedLoadStoreMotion/st_sink_check_debug.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -S -passes=debugify,mldst-motion -o - | FileCheck %s
+; RUN: opt < %s -S -passes=debugify,mldst-motion -o - --try-experimental-debuginfo-iterators | FileCheck %s
 
 %struct.S = type { i32 }
 
diff --git a/llvm/test/Transforms/SCCP/ipsccp-basic.ll b/llvm/test/Transforms/SCCP/ipsccp-basic.ll
index ce54bd99b4f76b6..71c042b9b294671 100644
--- a/llvm/test/Transforms/SCCP/ipsccp-basic.ll
+++ b/llvm/test/Transforms/SCCP/ipsccp-basic.ll
@@ -1,6 +1,7 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
 ; RUN: opt < %s -passes=ipsccp -S | FileCheck %s
 ; RUN: opt < %s -enable-debugify -passes=ipsccp -debugify-quiet -disable-output
+; RUN: opt < %s -enable-debugify -passes=ipsccp -debugify-quiet -disable-output --try-experimental-debuginfo-iterators
 
 ;;======================== test1
 
diff --git a/llvm/test/Transforms/SCCP/loadtest.ll b/llvm/test/Transforms/SCCP/loadtest.ll
index d71e258558fa43a..5674cfd7472a7da 100644
--- a/llvm/test/Transforms/SCCP/loadtest.ll
+++ b/llvm/test/Transforms/SCCP/loadtest.ll
@@ -4,6 +4,8 @@
 ; RUN: opt < %s -data-layout="E-p:32:32" -passes=debugify,sccp -S | FileCheck %s
 ; RUN: opt < %s -data-layout="E-p:32:32" -passes=debugify,ipsccp -S | FileCheck %s
 
+; RUN: opt < %s -data-layout="E-p:32:32" -passes=debugify,ipsccp -S --try-experimental-debuginfo-iterators | FileCheck %s
+
 @X = constant i32 42		; <ptr> [#uses=1]
 @Y = constant [2 x { i32, float }] [ { i32, float } { i32 12, float 1.000000e+00 }, { i32, float } { i32 37, float 0x3FF3B2FEC0000000 } ]		; <ptr> [#uses=2]
 
diff --git a/llvm/test/Transforms/SROA/alignment.ll b/llvm/test/Transforms/SROA/alignment.ll
index b870a15b312ca80..12de1fa3c5bc76e 100644
--- a/llvm/test/Transforms/SROA/alignment.ll
+++ b/llvm/test/Transforms/SROA/alignment.ll
@@ -2,6 +2,7 @@
 ; RUN: opt < %s -passes='sroa<preserve-cfg>' -S | FileCheck %s --check-prefixes=CHECK,CHECK-PRESERVE-CFG
 ; RUN: opt < %s -passes='sroa<modify-cfg>' -S | FileCheck %s --check-prefixes=CHECK,CHECK-MODIFY-CFG
 ; RUN: opt -passes='debugify,function(sroa<preserve-cfg>)' -S < %s | FileCheck %s -check-prefix CHECK-DEBUGLOC
+; RUN: opt -passes='debugify,function(sroa<preserve-cfg>)' -S < %s --try-experimental-debuginfo-iterators | FileCheck %s -check-prefix CHECK-DEBUGLOC
 
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-n8:16:32:64"
 
diff --git a/llvm/test/Transforms/SimplifyCFG/X86/merge-compatible-invokes-of-landingpad-debuginfo.ll b/llvm/test/Transforms/SimplifyCFG/X86/merge-compatible-invokes-of-landingpad-debuginfo.ll
index 801e81e6f49f25d..8d99621ca14c35f 100644
--- a/llvm/test/Transforms/SimplifyCFG/X86/merge-compatible-invokes-of-landingpad-debuginfo.ll
+++ b/llvm/test/Transforms/SimplifyCFG/X86/merge-compatible-invokes-of-landingpad-debuginfo.ll
@@ -1,6 +1,7 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-attributes --check-globals
 ; RUN: opt < %s -passes=debugify,simplifycfg -simplifycfg-require-and-preserve-domtree=1 -sink-common-insts -S | FileCheck %s
 ; RUN: opt < %s -passes='debugify,simplifycfg<sink-common-insts>' -S | FileCheck %s
+; RUN: opt < %s -passes='debugify,simplifycfg<sink-common-insts>' -S --try-experimental-debuginfo-iterators | FileCheck %s
 
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
diff --git a/llvm/test/Transforms/SimplifyCFG/debug-info-thread-phi.ll b/llvm/test/Transforms/SimplifyCFG/debug-info-thread-phi.ll
index b32ca9bf6aef249..6b22f427f1fef3f 100644
--- a/llvm/test/Transforms/SimplifyCFG/debug-info-thread-phi.ll
+++ b/llvm/test/Transforms/SimplifyCFG/debug-info-thread-phi.ll
@@ -1,4 +1,5 @@
 ; RUN: opt %s -passes=debugify,simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s
+; RUN: opt %s -passes=debugify,simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S --try-experimental-debuginfo-iterators | FileCheck %s
 ; Tests Bug 37966
 
 define void @bar(i32 %aa) {
diff --git a/llvm/test/Transforms/TailCallElim/debugloc.ll b/llvm/test/Transforms/TailCallElim/debugloc.ll
index 39e29d8a524f02c..3abbd6552efce33 100644
--- a/llvm/test/Transforms/TailCallElim/debugloc.ll
+++ b/llvm/test/Transforms/TailCallElim/debugloc.ll
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -passes=debugify,tailcallelim -S | FileCheck %s
+; RUN: opt < %s -passes=debugify,tailcallelim -S --try-experimental-debuginfo-iterators | FileCheck %s
 
 define void @foo() {
 entry:
diff --git a/llvm/test/Transforms/Util/Debugify/loc-only.ll b/llvm/test/Transforms/Util/Debugify/loc-only.ll
index e00135556f7eb8d..c8159f3e482b84e 100644
--- a/llvm/test/Transforms/Util/Debugify/loc-only.ll
+++ b/llvm/test/Transforms/Util/Debugify/loc-only.ll
@@ -1,6 +1,8 @@
 ; RUN: opt -passes=debugify -S < %s | FileCheck --check-prefixes=ALL,VALUE %s
 ; RUN: opt -passes=debugify -debugify-level=locations -S < %s | FileCheck --check-prefixes=ALL --implicit-check-not=dbg.value %s
 
+; RUN: opt -passes=debugify -S < %s --try-experimental-debuginfo-iterators | FileCheck --check-prefixes=ALL,VALUE %s
+
 ; ALL-LABEL: @test
 define void @test() {
   %add = add i32 1, 2

>From 971ea57fb49b83da2eea0897363a71f675c15229 Mon Sep 17 00:00:00 2001
From: Jeremy Morse <jeremy.morse at sony.com>
Date: Thu, 23 Nov 2023 16:18:25 +0000
Subject: [PATCH 2/2] Undo accidental RUN line deletion.

---
 .../test/Transforms/MergedLoadStoreMotion/st_sink_check_debug.ll | 1 +
 1 file changed, 1 insertion(+)

diff --git a/llvm/test/Transforms/MergedLoadStoreMotion/st_sink_check_debug.ll b/llvm/test/Transforms/MergedLoadStoreMotion/st_sink_check_debug.ll
index 351a65a013aec4e..915e3a84e8c7a46 100644
--- a/llvm/test/Transforms/MergedLoadStoreMotion/st_sink_check_debug.ll
+++ b/llvm/test/Transforms/MergedLoadStoreMotion/st_sink_check_debug.ll
@@ -1,3 +1,4 @@
+; RUN: opt < %s -S -passes=debugify,mldst-motion -o - | FileCheck %s
 ; RUN: opt < %s -S -passes=debugify,mldst-motion -o - --try-experimental-debuginfo-iterators | FileCheck %s
 
 %struct.S = type { i32 }



More information about the llvm-commits mailing list