1# RUN: llc -march=x86-64 -run-pass none -o - %s | FileCheck %s 2# This test ensures that the MIR parser parses pre- and post-instruction symbols 3# and MCSymbol operands correctly. 4 5--- | 6 declare void @f(i32 %x) nounwind 7 8 declare void @g(i32 %x) nounwind 9 10 declare void @h(i32 %x) nounwind 11 12 define i64 @test(i32 %x) nounwind { 13 entry: 14 call void @f(i32 %x) 15 call void @g(i32 %x) 16 call void @h(i32 %x), !dbg !9 17 ret i64 undef 18 } 19 20 !llvm.dbg.cu = !{!0} 21 !llvm.module.flags = !{!6, !7} 22 23 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !2, imports: !2) 24 !1 = !DIFile(filename: "test.ll", directory: "") 25 !2 = !{} 26 !4 = distinct !DISubprogram(name: "test", scope: !5, file: !5, line: 4, type: !2, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) 27 !5 = !DIFile(filename: "test.c", directory: "") 28 !6 = !{i32 2, !"Dwarf Version", i32 4} 29 !7 = !{i32 2, !"Debug Info Version", i32 3} 30 !9 = !DILocation(line: 1, scope: !4) 31 32... 33--- 34name: test 35# CHECK-LABEL: name: test 36tracksRegLiveness: true 37frameInfo: 38 hasCalls: true 39body: | 40 bb.0.entry: 41 liveins: $edi 42 43 %0:gr32 = COPY $edi 44 %1:gr32 = COPY killed %0 45 ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp 46 $edi = COPY %1 47 48 CALL64pcrel32 @f, csr_64, implicit $rsp, implicit $ssp, implicit $edi, pre-instr-symbol <mcsymbol .Lpre_f>, post-instr-symbol <mcsymbol .Lpost_f> 49 ; CHECK: CALL64pcrel32 @f, {{.*}}, pre-instr-symbol <mcsymbol .Lpre_f>, post-instr-symbol <mcsymbol .Lpost_f> 50 51 ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp 52 ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp 53 $edi = COPY %1 54 55 CALL64pcrel32 @g, csr_64, implicit $rsp, implicit $ssp, implicit $edi, pre-instr-symbol <mcsymbol .Lpre_g> 56 ; CHECK: CALL64pcrel32 @g, {{.*}}, pre-instr-symbol <mcsymbol .Lpre_g> 57 58 ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp 59 ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp 60 $edi = COPY %1 61 62 CALL64pcrel32 @h, csr_64, implicit $rsp, implicit $ssp, implicit $edi, post-instr-symbol <mcsymbol .Lpost_h>, debug-location !9 63 ; CHECK: CALL64pcrel32 @h, {{.*}}, post-instr-symbol <mcsymbol .Lpost_h>, debug-location 64 65 ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp 66 67 %2:gr64 = MOV64ri32 <mcsymbol .Lpre_f> 68 %3:gr64 = MOV64ri32 <mcsymbol .Lpost_f> 69 %4:gr64 = MOV64ri32 <mcsymbol .Lpre_g> 70 %5:gr64 = MOV64ri32 <mcsymbol .Lpost_h> 71 ; CHECK: %2:gr64 = MOV64ri32 <mcsymbol .Lpre_f> 72 ; CHECK: %3:gr64 = MOV64ri32 <mcsymbol .Lpost_f> 73 ; CHECK: %4:gr64 = MOV64ri32 <mcsymbol .Lpre_g> 74 ; CHECK: %5:gr64 = MOV64ri32 <mcsymbol .Lpost_h> 75 76 %6:gr64 = ADD64rr killed %2, killed %3, implicit-def $eflags 77 %7:gr64 = ADD64rr killed %4, killed %5, implicit-def $eflags 78 %8:gr64 = ADD64rr killed %6, killed %7, implicit-def $eflags 79 $rax = COPY %8 80 RETQ implicit $rax 81 82... 83