1# RUN: llc -run-pass=mir-debugify -o - %s | FileCheck --check-prefixes=ALL,VALUE %s 2# RUN: llc -run-pass=mir-debugify -debugify-level=locations -o - %s | FileCheck --check-prefixes=ALL --implicit-check-not=dbg.value %s 3# RUN: llc -run-pass=mir-debugify,mir-strip-debug,mir-debugify -o - %s | FileCheck --check-prefixes=ALL,VALUE %s 4--- | 5 ; ModuleID = 'loc-only.ll' 6 source_filename = "loc-only.ll" 7 8 ; ALL-LABEL: @test 9 define i32 @test(i32 %a, i32 %b) { 10 %add = add i32 %a, 2 11 ; ALL-NEXT: %add = add i32 %a, 2, !dbg [[L1:![0-9]+]] 12 ; VALUE-NEXT: call{{( addrspace\([0-9]+\))?}} void @llvm.dbg.value(metadata i32 %add, metadata [[add:![0-9]+]], metadata !DIExpression()), !dbg [[L1]] 13 %sub = sub i32 %add, %b 14 ; ALL-NEXT: %sub = sub i32 %add, %b, !dbg [[L2:![0-9]+]] 15 ; VALUE-NEXT: call{{( addrspace\([0-9]+\))?}} void @llvm.dbg.value(metadata i32 %sub, metadata [[sub:![0-9]+]], metadata !DIExpression()), !dbg [[L2]] 16 ; ALL-NEXT: ret i32 %sub, !dbg [[L3:![0-9]+]] 17 ret i32 %sub 18 } 19 20 ; ALL: !llvm.dbg.cu = !{![[CU:[0-9]+]]} 21 ; ALL: !llvm.debugify = 22 ; ALL: !llvm.module.flags = !{![[VERSION:[0-9]+]]} 23 ; ALL: ![[CU]] = distinct !DICompileUnit( 24 ; ALL: ![[VERSION]] = !{i32 2, !"Debug Info Version", i32 3} 25 ; VALUE: [[VAR1:![0-9]+]] = !DILocalVariable(name: "1" 26 ; VALUE: [[VAR2:![0-9]+]] = !DILocalVariable(name: "2" 27 28... 29--- 30name: test 31body: | 32 bb.1 (%ir-block.0): 33 %0:_(s32) = IMPLICIT_DEF 34 %1:_(s32) = IMPLICIT_DEF 35 %2:_(s32) = G_CONSTANT i32 2 36 %3:_(s32) = G_ADD %0, %2 37 %4:_(s32) = G_SUB %3, %1 38 ; There's no attempt to have the locations make sense as it's an imaginary 39 ; source file anyway. These first three coincide with IR-level information 40 ; and therefore use metadata references. 41 ; ALL: %0:_(s32) = IMPLICIT_DEF debug-location [[L1]] 42 ; VALUE: DBG_VALUE %0(s32), $noreg, [[VAR1]], !DIExpression(), debug-location [[L1]] 43 ; ALL: %1:_(s32) = IMPLICIT_DEF debug-location [[L2]] 44 ; VALUE: DBG_VALUE %1(s32), $noreg, [[VAR2]], !DIExpression(), debug-location [[L2]] 45 ; ALL: %2:_(s32) = G_CONSTANT i32 2, debug-location [[L3]] 46 ; VALUE: DBG_VALUE %2(s32), $noreg, [[VAR1]], !DIExpression(), debug-location [[L3]] 47 ; ALL: %3:_(s32) = G_ADD %0, %2, debug-location !DILocation(line: 4, column: 1, scope: [[SP:![0-9]+]]) 48 ; VALUE: DBG_VALUE %3(s32), $noreg, [[VAR1]], !DIExpression(), debug-location !DILocation(line: 4 49 ; ALL: %4:_(s32) = G_SUB %3, %1, debug-location !DILocation(line: 5, column: 1, scope: [[SP]]) 50 ; VALUE: DBG_VALUE %4(s32), $noreg, [[VAR1]], !DIExpression(), debug-location !DILocation(line: 5 51... 52