1 ; RUN: llc -mtriple=x86_64-unknown-linux-gnu -start-after=codegenprepare -stop-before=finalize-isel -o - %s | FileCheck %s
3 ; Input to this test looked like this and was compiled using: clang -g -O1 -mllvm -stop-after=codegenprepare -S
10 ; Catch metadata references for involved variables.
12 ; CHECK-DAG: ![[T1:.*]] = !DILocalVariable(name: "t1"
15 define dso_local i32 @fn1(i64 %t1) local_unnamed_addr #0 !dbg !7 {
16 ; We expect that the same width COPY reuses the debug location,
17 ; but the width narrowing COPY does not.
19 ; CHECK-LABEL: name: fn1
20 ; CHECK: DBG_VALUE $rdi, $noreg, ![[T1]], !DIExpression(),
21 ; CHECK-NEXT: %0:gr64 = COPY $rdi
22 ; CHECK-NEXT: DBG_VALUE %0, $noreg, ![[T1]], !DIExpression(),
23 ; CHECK-NEXT: %1:gr32 = COPY %0.sub_32bit
27 call void @llvm.dbg.value(metadata i64 %t1, metadata !13, metadata !DIExpression()), !dbg !14
28 %0 = trunc i64 %t1 to i32, !dbg !15
32 declare void @llvm.dbg.value(metadata, metadata, metadata) #1
34 attributes #0 = { norecurse nounwind readnone uwtable }
35 attributes #1 = { nounwind readnone speculatable willreturn }
38 !llvm.module.flags = !{!3, !4, !5}
41 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 11.0.0 (git@github.com:tbosch/llvm-project.git 0b11aed869bf09ba60
42 d7ed17334cf0b76e6a5922)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
43 !1 = !DIFile(filename: "test.cc", directory: "")
45 !3 = !{i32 7, !"Dwarf Version", i32 4}
46 !4 = !{i32 2, !"Debug Info Version", i32 3}
47 !5 = !{i32 1, !"wchar_size", i32 4}
48 !6 = !{!"clang version 11.0.0 (git@github.com:tbosch/llvm-project.git 0b11aed869bf09ba60d7ed17334cf0b76e6a5922)"}
49 !7 = distinct !DISubprogram(name: "fn1", scope: !1, file: !1, line: 1, type: !8, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !12)
50 !8 = !DISubroutineType(types: !9)
52 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
53 !11 = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed)
55 !13 = !DILocalVariable(name: "t1", arg: 1, scope: !7, file: !1, line: 1, type: !11)
56 !14 = !DILocation(line: 0, scope: !7)
57 !15 = !DILocation(line: 2, column: 10, scope: !7)
58 !16 = !DILocation(line: 2, column: 3, scope: !7)