[llvm] [DebugInfo][RemoveDIs] Use autoupgrader to convert old debug-info (PR #143452)

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 10 02:51:07 PDT 2025


================
@@ -0,0 +1,80 @@
+; RUN: llvm-as %s -o - 2>&1 | FileCheck %s
+; CHECK: invalid #dbg record expression
+;
+; Fossilised debug-info with only two arguments to dbg.declare have been
+; spotted in LLVMs test suite (debug-info-always-inline.ll), test that this
+; does not cause a crash. LLVM needs to be able to autoupgrade invalid
+; dbg.declares to invalid #dbg_declares because this occurs before the
+; Verifier runs.
+
+; ModuleID = 'out.ll'
+source_filename = "llvm/test/DebugInfo/Generic/debug-info-always-inline.ll"
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+declare void @llvm.dbg.declare(metadata, metadata, metadata)
+
+; Function Attrs: alwaysinline nounwind sspstrong
+define i32 @_Z3foov() #0 !dbg !7 {
+entry:
+  %arr = alloca [10 x i32], align 16, !dbg !10
+  %sum = alloca i32, align 4, !dbg !11
+  call void @llvm.dbg.declare(metadata ptr %sum,  metadata !26), !dbg !11
+  store i32 5, ptr %arr, align 4, !dbg !12
+  store i32 4, ptr %sum, align 4, !dbg !13
+  %0 = load i32, ptr %sum, align 4, !dbg !14
+  ret i32 %0, !dbg !15
----------------
OCHyams wrote:

I feel like this test could be simplified - do these functions need any bodies at all, or can we just have the dbg.declare? do we need two functions?

https://github.com/llvm/llvm-project/pull/143452


More information about the llvm-commits mailing list