xref: /llvm-project/llvm/test/CodeGen/MIR/X86/tail-merging-preserve-debugloc.mir (revision 836703087d761f9cbf81b6f9593bc5313660f559)
1# RUN: llc -o - %s -mtriple=x86_64-unknown-linux-gnu --run-pass=branch-folder -enable-tail-merge | FileCheck %s
2#
3# Generated with
4#
5# bin/llc -stop-before=branch-folder test.ll
6#
7# 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"
8# target triple = "x86_64-grtev4-linux-gnu"
9#
10# define i32 @main(i1 %0) {
11# entry:
12#   br i1 %0, label %1, label %2
13#
14# 1:                                                ; preds = %entry
15#   store i64 1, ptr null, align 1
16#   br label %3, !dbg !3
17#
18# 2:                                                ; preds = %entry
19#   store i64 0, ptr null, align 1
20#   br label %3
21#
22# 3:                                                ; preds = %2, %1
23#   ret i32 0
24# }
25#
26# !llvm.dbg.cu = !{!0}
27# !llvm.module.flags = !{!2}
28#
29# !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, nameTableKind: None)
30# !1 = !DIFile(filename: "foo.c", directory: "/tmp", checksumkind: CSK_MD5, checksum: "2d07c91bb9d9c2fa4eee31a1aeed20e3")
31# !2 = !{i32 2, !"Debug Info Version", i32 3}
32# !3 = !DILocation(line: 17, column: 3, scope: !4)
33# !4 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 6, type: !5, scopeLine: 6, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0)
34# !5 = !DISubroutineType(types: !6)
35# !6 = !{}
36--- |
37
38  ; ModuleID = '../llvm/test/CodeGen/X86/tail-merging-preserve-debugloc.ll'
39  source_filename = "../llvm/test/CodeGen/X86/tail-merging-preserve-debugloc.ll"
40  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"
41  target triple = "x86_64-grtev4-linux-gnu"
42
43  define i32 @main(i1 %0) {
44  entry:
45    br i1 %0, label %1, label %2
46
47  1:                                                ; preds = %entry
48    store i64 1, ptr null, align 1
49    br label %3, !dbg !3
50
51  2:                                                ; preds = %entry
52    store i64 0, ptr null, align 1
53    br label %3
54
55  3:                                                ; preds = %2, %1
56    ret i32 0
57  }
58
59  !llvm.dbg.cu = !{!0}
60  !llvm.module.flags = !{!2}
61
62  !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, nameTableKind: None)
63  !1 = !DIFile(filename: "foo.c", directory: "/tmp", checksumkind: CSK_MD5, checksum: "2d07c91bb9d9c2fa4eee31a1aeed20e3")
64  !2 = !{i32 2, !"Debug Info Version", i32 3}
65  !3 = !DILocation(line: 17, column: 3, scope: !4)
66  !4 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 6, type: !5, scopeLine: 6, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0)
67  !5 = !DISubroutineType(types: !6)
68  !6 = !{}
69
70...
71---
72name:            main
73body:             |
74  bb.0.entry:
75    successors: %bb.1(0x40000000), %bb.2(0x40000000)
76    liveins: $edi
77
78    TEST8ri renamable $dil, 1, implicit-def $eflags, implicit killed $edi
79    JCC_1 %bb.2, 4, implicit killed $eflags
80    JMP_1 %bb.1
81
82  bb.1 (%ir-block.1):
83    successors: %bb.3(0x80000000)
84
85    MOV64mi32 $noreg, 1, $noreg, 0, $noreg, 1 :: (store (s64) into `ptr null`, align 1)
86    JMP_1 %bb.3, debug-location !3
87
88  bb.2 (%ir-block.2):
89    successors: %bb.3(0x80000000)
90
91    MOV64mi32 $noreg, 1, $noreg, 0, $noreg, 0 :: (store (s64) into `ptr null`, align 1)
92
93  bb.3 (%ir-block.3):
94    $eax = MOV32r0 implicit-def dead $eflags
95    RET 0, killed $eax
96
97...
98# CHECK: [[DEBUGNUM:!.*]] = !DILocation(line: 17, column: 3,
99# CHECK: JMP_1 %bb.3, debug-location [[DEBUGNUM]]
100