<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/72523>72523</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [DebugInfo] Old-metadata being dropped causing lost test coverage
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            debuginfo
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          jmorse
      </td>
    </tr>
</table>

<pre>
    We've started looking at automagically upgrading the debug-info in tests for the "RemoveDIs" project, replacing dbg.value intrinsics with non-instruction data. It turns out that a decent number of tests with debug-info in them have the debug-info silently dropped by the module parser: that's expected for some tests, but not for meaningful / functional ones. I stuck a call to `abort` in `DiagnosticInfoDebugMetadataVersion::print`, and the following tests failed. Picking a few at random, it does appear that we're losing test coverage because the debug-info-metadata on these tests haven't been upgraded. For example CodeGen/X86/dbg-changes-codegen.ll. Or CodeGen/Generic/dbg_value.ll. Some of these tests might not have any value nowadays, but we should still investigate them.

A full list:

````
Failed Tests (48):
  LLVM :: Analysis/GlobalsModRef/pr12351.ll
  LLVM :: Assembler/drop-debug-info.ll
  LLVM :: Bitcode/PR23310.test
  LLVM :: Bitcode/apple-clang-700-compat.test
  LLVM :: Bitcode/dityperefs-3.8.ll
  LLVM :: Bitcode/drop-debug-info.3.5.ll
 LLVM :: BugPoint/named-md.ll
  LLVM :: CodeGen/AArch64/PHIElimination-debugloc.mir
  LLVM :: CodeGen/ARM/2009-10-16-Scope.ll
  LLVM :: CodeGen/Generic/dbg_value.ll
 LLVM :: CodeGen/RISCV/copy-frameindex.mir
  LLVM :: CodeGen/RISCV/rvv/get-vlen-debugloc.mir
  LLVM :: CodeGen/Thumb2/LowOverheadLoops/vpt-block-debug.mir
  LLVM :: CodeGen/X86/2009-02-12-DebugInfoVLA.ll
  LLVM :: CodeGen/X86/2009-10-16-Scope.ll
  LLVM :: CodeGen/X86/2010-02-01-DbgValueCrash.ll
  LLVM :: CodeGen/X86/2010-07-06-DbgCrash.ll
  LLVM :: CodeGen/X86/dbg-changes-codegen.ll
  LLVM :: DebugInfo/AArch64/big-endian-dump.ll
  LLVM :: DebugInfo/AArch64/little-endian-dump.ll
  LLVM :: DebugInfo/AArch64/processes-relocations.ll
  LLVM :: DebugInfo/ARM/big-endian-dump.ll
  LLVM :: DebugInfo/ARM/little-endian-dump.ll
  LLVM :: DebugInfo/ARM/processes-relocations.ll
  LLVM :: DebugInfo/ARM/selectiondag-deadcode.ll
  LLVM :: DebugInfo/Generic/2009-10-16-Phi.ll
  LLVM :: DebugInfo/Generic/2010-03-12-llc-crash.ll
  LLVM :: DebugInfo/Generic/debug-info-always-inline.ll
  LLVM :: DebugInfo/Generic/inheritance.ll
  LLVM :: DebugInfo/Lanai/processes-relocations.ll
  LLVM :: DebugInfo/Mips/processes-relocations.ll
  LLVM :: DebugInfo/PowerPC/processes-relocations.ll
  LLVM :: DebugInfo/Sparc/processes-relocations.ll
  LLVM :: DebugInfo/SystemZ/processes-relocations.ll
  LLVM :: DebugInfo/strip-DIGlobalVariable.ll
  LLVM :: Linker/2009-09-03-mdnode.ll
  LLVM :: Linker/debug-info-version-a.ll
 LLVM :: Linker/drop-debug.ll
  LLVM :: ThinLTO/X86/drop-debug-info.ll
 LLVM :: Transforms/DeadStoreElimination/merge-stores.ll
  LLVM :: Transforms/IROutliner/outlining-debug-statements.ll
  LLVM :: Transforms/LoopStrengthReduce/pr12018.ll
  LLVM :: Transforms/MergeFunc/mergefunc-preserve-nonnull.ll
  LLVM :: Transforms/SampleProfile/summary.ll
  LLVM :: Transforms/SimplifyCFG/branch-fold-dbg.ll
  LLVM :: tools/llvm-reduce/remove-metadata.ll
  LLVM-Unit :: Analysis/./AnalysisTests/0/11
  LLVM-Unit :: Analysis/./AnalysisTests/6/11
````
A few of these are obviously spurious, "Linker/drop-debug.ll" should indeed fail if we put `abort` in the code path, but anything in Transforms or DebugInfo or CodeGen shouldn't fail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