[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
+}
+
+; Function Attrs: nounwind sspstrong
+define i32 @main() #1 !dbg !16 {
+entry:
+ %retval = alloca i32, align 4, !dbg !17
+ %i = alloca i32, align 4, !dbg !18
+ store i32 0, ptr %retval, align 4, !dbg !19
+ call void @_Z3barv(), !dbg !20
+ %call = call i32 @_Z3foov(), !dbg !21
+ store i32 %call, ptr %i, align 4, !dbg !22
+ %0 = load i32, ptr %i, align 4, !dbg !23
+ ret i32 %0, !dbg !24
+}
+
+declare void @_Z3barv() #2
+
+attributes #0 = { alwaysinline nounwind sspstrong "frame-pointer"="none" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { nounwind sspstrong "frame-pointer"="none" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #2 = { "frame-pointer"="none" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
----------------
OCHyams wrote:
do we need all the attributes?
https://github.com/llvm/llvm-project/pull/143452
More information about the llvm-commits
mailing list