[llvm] [DebugInfo] Find call site values for params in preserved registers (PR #172339)
David Stenberg via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 17 07:05:51 PST 2025
================
@@ -0,0 +1,124 @@
+# RUN: llc %s -o - -filetype=obj -start-after=livedebugvalues \
+# RUN: -emit-call-site-info | \
+# RUN: llvm-dwarfdump - | FileCheck %s
+
+--- |
+ ; ModuleID = 'pr43464.c'
+ source_filename = "pr43464.c"
+ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
+ target triple = "x86_64-unknown-linux-gnu"
+
+ ; Function Attrs: nounwind uwtable
+ define dso_local noundef i32 @caller() local_unnamed_addr #0 !dbg !10 {
+ entry:
+ %call = tail call i64 @value() #2, !dbg !17
+ #dbg_value(i64 %call, !15, !DIExpression(), !18)
+ tail call void @callee(i64 noundef %call) #2, !dbg !19
+ %conv = trunc i64 %call to i32, !dbg !20
+ ret i32 %conv, !dbg !21
+ }
+
+ declare !dbg !22 i64 @value() local_unnamed_addr #1
+
+ declare !dbg !25 void @callee(i64 noundef) local_unnamed_addr #1
+
+ attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
+ attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
+ attributes #2 = { nounwind }
+
+ !llvm.dbg.cu = !{!0}
+ !llvm.module.flags = !{!2, !3, !4, !5, !6, !7, !8}
+ !llvm.ident = !{!9}
+
+ !0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang version 22.0.0git.prerel", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
+ !1 = !DIFile(filename: "pr43464.c", directory: "/repo/edasten/llvm-project/llvm", checksumkind: CSK_MD5, checksum: "e63080e8df26470df7e757aa6a4ccecd")
+ !2 = !{i32 7, !"Dwarf Version", i32 5}
+ !3 = !{i32 2, !"Debug Info Version", i32 3}
+ !4 = !{i32 1, !"wchar_size", i32 4}
+ !5 = !{i32 8, !"PIC Level", i32 2}
+ !6 = !{i32 7, !"PIE Level", i32 2}
+ !7 = !{i32 7, !"uwtable", i32 2}
+ !8 = !{i32 7, !"debug-info-assignment-tracking", i1 true}
+ !9 = !{!"clang version 22.0.0git.prerel"}
+ !10 = distinct !DISubprogram(name: "caller", scope: !1, file: !1, line: 4, type: !11, scopeLine: 4, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !14, keyInstructions: true)
+ !11 = !DISubroutineType(types: !12)
+ !12 = !{!13}
+ !13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+ !14 = !{!15}
+ !15 = !DILocalVariable(name: "local", scope: !10, file: !1, line: 5, type: !16)
+ !16 = !DIBasicType(name: "long", size: 64, encoding: DW_ATE_signed)
+ !17 = !DILocation(line: 5, scope: !10, atomGroup: 1, atomRank: 2)
+ !18 = !DILocation(line: 0, scope: !10)
+ !19 = !DILocation(line: 6, scope: !10)
+ !20 = !DILocation(line: 7, scope: !10, atomGroup: 3, atomRank: 2)
+ !21 = !DILocation(line: 7, scope: !10, atomGroup: 3, atomRank: 1)
+ !22 = !DISubprogram(name: "value", scope: !1, file: !1, line: 2, type: !23, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized)
+ !23 = !DISubroutineType(types: !24)
+ !24 = !{!16}
+ !25 = !DISubprogram(name: "callee", scope: !1, file: !1, line: 1, type: !26, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized)
+ !26 = !DISubroutineType(types: !27)
+ !27 = !{null, !16}
+...
+---
+name: caller
+alignment: 16
+tracksRegLiveness: true
+noPhis: true
+isSSA: false
+noVRegs: true
+hasFakeUses: false
+debugInstrRef: true
+tracksDebugUserValues: true
+frameInfo:
+ stackSize: 8
+ offsetAdjustment: -8
+ maxAlignment: 1
+ adjustsStack: true
+ hasCalls: true
+ maxCallFrameSize: 0
+ cvBytesOfCalleeSavedRegisters: 8
+ isCalleeSavedInfoValid: true
+fixedStack:
+ - { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 16, callee-saved-register: '$rbx' }
+callSites:
+ - { bb: 0, offset: 9, fwdArgRegs:
+ - { arg: 0, reg: '$rdi' } }
+machineFunctionInfo:
+ amxProgModel: None
+body: |
+ bb.0.entry:
+ liveins: $rbx
+
+ frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp, debug-location !17
+ frame-setup CFI_INSTRUCTION def_cfa_offset 16
+ CFI_INSTRUCTION offset $rbx, -16
+ CALL64pcrel32 target-flags(x86-plt) @value, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax, debug-instr-number 1, debug-location !17
+ $rbx = MOV64rr $rax, debug-location !17
+ DBG_INSTR_REF !15, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(1, 6), debug-location !18
+ DBG_VALUE_LIST !15, !DIExpression(DW_OP_LLVM_arg, 0), $rbx, debug-location !18
+ $rdi = MOV64rr $rax, debug-location !19
+ ; Manually inserted instruction partially convering $rbx.
----------------
dstenb wrote:
Fixed.
https://github.com/llvm/llvm-project/pull/172339
More information about the llvm-commits
mailing list