Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DebugInfo][RemoveDIs] Make debugify pass convert to/from RemoveDIs mode #73251

Merged
merged 3 commits into from
Nov 29, 2023

Conversation

jmorse
Copy link
Member

@jmorse jmorse commented Nov 23, 2023

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.

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.
@llvmbot
Copy link
Collaborator

llvmbot commented Nov 23, 2023

@llvm/pr-subscribers-llvm-transforms

@llvm/pr-subscribers-debuginfo

Author: Jeremy Morse (jmorse)

Changes

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.


Patch is 27.72 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/73251.diff

33 Files Affected:

  • (modified) llvm/lib/Transforms/Utils/Debugify.cpp (+59-6)
  • (modified) llvm/test/Transforms/ArgumentPromotion/pr27568.ll (+1)
  • (modified) llvm/test/Transforms/BDCE/basic.ll (+1)
  • (modified) llvm/test/Transforms/DCE/basic.ll (+1)
  • (modified) llvm/test/Transforms/DeadStoreElimination/debuginfo.ll (+1)
  • (modified) llvm/test/Transforms/GlobalOpt/shrink-global-to-bool-check-debug.ll (+1)
  • (modified) llvm/test/Transforms/InstCombine/call-guard.ll (+1)
  • (modified) llvm/test/Transforms/InstCombine/cast-mul-select.ll (+4)
  • (modified) llvm/test/Transforms/InstCombine/debuginfo-variables.ll (+1)
  • (modified) llvm/test/Transforms/InstCombine/double-float-shrink-2.ll (+1)
  • (modified) llvm/test/Transforms/InstCombine/storemerge-dbg.ll (+1)
  • (modified) llvm/test/Transforms/JumpThreading/branch-debug-info.ll (+1)
  • (modified) llvm/test/Transforms/LCSSA/avoid-intrinsics-in-catchswitch.ll (+1)
  • (modified) llvm/test/Transforms/LCSSA/basictest.ll (+1)
  • (modified) llvm/test/Transforms/LICM/sinking-debugify.ll (+1)
  • (modified) llvm/test/Transforms/LoopIdiom/X86/arithmetic-right-shift-until-zero.ll (+1)
  • (modified) llvm/test/Transforms/LoopIdiom/X86/left-shift-until-bittest.ll (+1)
  • (modified) llvm/test/Transforms/LoopIdiom/X86/logical-right-shift-until-zero-debuginfo.ll (+1)
  • (modified) llvm/test/Transforms/LoopIdiom/memcpy-debugify-remarks.ll (+3)
  • (modified) llvm/test/Transforms/LoopIdiom/memset-debugify-remarks.ll (+3)
  • (modified) llvm/test/Transforms/LoopUnroll/X86/call-remark.ll (+2)
  • (modified) llvm/test/Transforms/LoopVectorize/i8-induction.ll (+1)
  • (modified) llvm/test/Transforms/LoopVectorize/preserve-dbg-loc-and-loop-metadata.ll (+1)
  • (modified) llvm/test/Transforms/Mem2Reg/PromoteMemToRegister.ll (+1)
  • (modified) llvm/test/Transforms/MemCpyOpt/pr37967.ll (+1)
  • (modified) llvm/test/Transforms/MergedLoadStoreMotion/st_sink_check_debug.ll (+1-1)
  • (modified) llvm/test/Transforms/SCCP/ipsccp-basic.ll (+1)
  • (modified) llvm/test/Transforms/SCCP/loadtest.ll (+2)
  • (modified) llvm/test/Transforms/SROA/alignment.ll (+1)
  • (modified) llvm/test/Transforms/SimplifyCFG/X86/merge-compatible-invokes-of-landingpad-debuginfo.ll (+1)
  • (modified) llvm/test/Transforms/SimplifyCFG/debug-info-thread-phi.ll (+1)
  • (modified) llvm/test/Transforms/TailCallElim/debugloc.ll (+1)
  • (modified) llvm/test/Transforms/Util/Debugify/loc-only.ll (+2)
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-experimenta...
[truncated]

Copy link

github-actions bot commented Nov 23, 2023

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff 1fb91beb173b1c3ca93c6ac6e01aab210369e083 748c35e1355576f7d1294c2824315367f33ffcf6 -- llvm/lib/Transforms/Utils/Debugify.cpp
View the diff from clang-format here.
diff --git a/llvm/lib/Transforms/Utils/Debugify.cpp b/llvm/lib/Transforms/Utils/Debugify.cpp
index d0cc603426..bcea45b653 100644
--- a/llvm/lib/Transforms/Utils/Debugify.cpp
+++ b/llvm/lib/Transforms/Utils/Debugify.cpp
@@ -805,7 +805,8 @@ struct DebugifyModulePass : public ModulePass {
     if (NewDebugMode)
       M.convertFromNewDbgValues();
 
-    bool Result = applyDebugify(M, Mode, DebugInfoBeforePass, NameOfWrappedPass);
+    bool Result =
+        applyDebugify(M, Mode, DebugInfoBeforePass, NameOfWrappedPass);
 
     if (NewDebugMode)
       M.convertToNewDbgValues();
@@ -838,7 +839,8 @@ struct DebugifyFunctionPass : public FunctionPass {
     if (NewDebugMode)
       F.convertFromNewDbgValues();
 
-    bool Result = applyDebugify(F, Mode, DebugInfoBeforePass, NameOfWrappedPass);
+    bool Result =
+        applyDebugify(F, Mode, DebugInfoBeforePass, NameOfWrappedPass);
 
     if (NewDebugMode)
       F.convertToNewDbgValues();
@@ -875,12 +877,12 @@ struct CheckDebugifyModulePass : public ModulePass {
     bool Result;
     if (Mode == DebugifyMode::SyntheticDebugInfo)
       Result = checkDebugifyMetadata(M, M.functions(), NameOfWrappedPass,
-                                   "CheckModuleDebugify", Strip, StatsMap);
+                                     "CheckModuleDebugify", Strip, StatsMap);
     else
       Result = checkDebugInfoMetadata(
-        M, M.functions(), *DebugInfoBeforePass,
-        "CheckModuleDebugify (original debuginfo)", NameOfWrappedPass,
-        OrigDIVerifyBugsReportFilePath);
+          M, M.functions(), *DebugInfoBeforePass,
+          "CheckModuleDebugify (original debuginfo)", NameOfWrappedPass,
+          OrigDIVerifyBugsReportFilePath);
 
     if (NewDebugMode)
       M.convertToNewDbgValues();
@@ -927,13 +929,13 @@ struct CheckDebugifyFunctionPass : public FunctionPass {
     bool Result;
     if (Mode == DebugifyMode::SyntheticDebugInfo)
       Result = checkDebugifyMetadata(M, make_range(FuncIt, std::next(FuncIt)),
-                                   NameOfWrappedPass, "CheckFunctionDebugify",
-                                   Strip, StatsMap);
+                                     NameOfWrappedPass, "CheckFunctionDebugify",
+                                     Strip, StatsMap);
     else
       Result = checkDebugInfoMetadata(
-        M, make_range(FuncIt, std::next(FuncIt)), *DebugInfoBeforePass,
-        "CheckFunctionDebugify (original debuginfo)", NameOfWrappedPass,
-        OrigDIVerifyBugsReportFilePath);
+          M, make_range(FuncIt, std::next(FuncIt)), *DebugInfoBeforePass,
+          "CheckFunctionDebugify (original debuginfo)", NameOfWrappedPass,
+          OrigDIVerifyBugsReportFilePath);
 
     if (NewDebugMode)
       F.convertToNewDbgValues();
@@ -1022,7 +1024,7 @@ PreservedAnalyses NewPMDebugifyPass::run(Module &M, ModuleAnalysisManager &) {
                               NameOfWrappedPass);
 
   if (NewDebugMode)
-      M.convertToNewDbgValues();
+    M.convertToNewDbgValues();
 
   PreservedAnalyses PA;
   PA.preserveSet<CFGAnalyses>();

Copy link
Contributor

@OCHyams OCHyams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM other than a quibble about the variable name

@@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't NewDebugMode makes more sense than OldDebugMode?

@jmorse jmorse merged commit d2d9dc8 into llvm:main Nov 29, 2023
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants