# 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" define dso_local noundef i32 @caller() local_unnamed_addr !dbg !10 { entry: %call = tail call i64 @value(), !dbg !17 #dbg_value(i64 %call, !15, !DIExpression(), !18) tail call void @callee(i64 noundef %call), !dbg !19 %conv = trunc i64 %call to i32, !dbg !20 ret i32 %conv, !dbg !21 } declare !dbg !22 i64 @value() local_unnamed_addr declare !dbg !25 void @callee(i64 noundef) local_unnamed_addr !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: "/", 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 fixedStack: - { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 16, callee-saved-register: '$rbx' } callSites: - { bb: 0, offset: 3 } - { bb: 0, offset: 8, fwdArgRegs: - { arg: 0, reg: '$rdi' } } 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 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 $rbx = MOV64rr $rax, debug-location !17 CALL64pcrel32 target-flags(x86-plt) @callee, csr_64, implicit $rsp, implicit $ssp, implicit killed $rdi, implicit-def $rsp, implicit-def $ssp, debug-location !19 $eax = MOV32rr $ebx, implicit killed $rbx, debug-location !21 $rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !21 frame-destroy CFI_INSTRUCTION def_cfa_offset 8, debug-location !21 RET64 $eax, debug-location !21 ... # Generated from the following C reproducer: # # extern void callee(long); # extern long value(void); # # int caller() { # long local = value(); # callee(local); # return local; # } # # but with the order of the instructions saving the value of `local` in $rbx # with the copy of $rax to $rdi switched. # # FIXME: The call site value interpreting code iterates # instruction-by-instruction upwards, and does not keep track of which register # values are saved during the call by succeeding instructions, so it does not # understand that the value of $rdi is available in $rbx. # CHECK-NOT: call_site_parameter