brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · c7e2e28 Raw
90 lines · plain
1# RUN: llc -mtriple=x86_64-none-linux-gnu -run-pass=postra-machine-sink -verify-machineinstrs  -o - %s | FileCheck %s2# RUN: llc -mtriple=x86_64-none-linux-gnu -passes=postra-machine-sink  -o - %s | FileCheck %s3#4# This test was originally generated from the following sample:5#6# int x0;7# extern void x3(int, int);8# void x1(int x2) {9#   if (x0)10#     x3(0, x2);11# }12#13# The code generates a COPY instruction which the PostRA Machine Sink pass will14# try to sink.  Earlier versions were not performing the sink due to a15# DBG_VALUE instruction confusing the sinking algorithm.16 17--- |18  @x0 = common dso_local global i32 0, align 4, !dbg !019 20  define dso_local void @x1(i32) !dbg !11 {21    %2 = alloca i32, align 422    store i32 %0, ptr %2, align 423    call void @llvm.dbg.declare(metadata ptr %2, metadata !14, metadata !DIExpression()), !dbg !1624    %3 = load i32, ptr @x0, align 4, !dbg !1625    %4 = icmp ne i32 %3, 0, !dbg !1626    br i1 %4, label %5, label %7, !dbg !1627 28  ; <label>:5:                                      ; preds = %129    %6 = load i32, ptr %2, align 4, !dbg !1630    call void @x3(i32 0, i32 %6), !dbg !1631    br label %7, !dbg !1632 33  ; <label>:7:                                      ; preds = %5, %134    ret void, !dbg !1635  }36 37  declare void @llvm.dbg.declare(metadata, metadata, metadata)38  declare dso_local void @x3(i32, i32)39 40  !llvm.dbg.cu = !{!2}41  !llvm.module.flags = !{!7, !8}42 43  !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())44  !1 = distinct !DIGlobalVariable(name: "x0", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)45  !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)46  !3 = !DIFile(filename: "test.c", directory: "")47  !4 = !{}48  !5 = !{!0}49  !6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)50  !7 = !{i32 2, !"Dwarf Version", i32 4}51  !8 = !{i32 2, !"Debug Info Version", i32 3}52  !11 = distinct !DISubprogram(name: "x1", scope: !3, file: !3, line: 3, type: !12, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !2)53  !12 = !DISubroutineType(types: !13)54  !13 = !{null, !6}55  !14 = !DILocalVariable(name: "x2", arg: 1, scope: !11, file: !3, line: 3, type: !6)56  !15 = distinct !DILexicalBlock(scope: !11, file: !3, line: 4, column: 7)57  !16 = !DILocation(line: 4, column: 7, scope: !15)58 59...60---61# CHECK: name: x162# CHECK: bb.0:63# CHECK-NOT: $eax = COPY $edi64# CHECK: bb.1:65# CHECK: renamable $eax = COPY $edi66# CHECK-NEXT: DBG_VALUE $eax,67# CHECK: bb.2:68name:            x169alignment:       1670tracksRegLiveness: true71body: |72  bb.0:73    successors: %bb.2, %bb.1; %bb.2, %bb.174    liveins: $edi75    DBG_VALUE $edi, $noreg, !14, !DIExpression(), debug-location !1676    renamable $eax = COPY $edi77    DBG_VALUE $eax, $noreg, !14, !DIExpression(), debug-location !1678    CMP32mi8 $rip, 1, $noreg, @x0, $noreg, 0, implicit-def $eflags, debug-location !1679    JCC_1 %bb.2, 4, implicit killed $eflags, debug-location !1680    JMP_1 %bb.1, debug-location !1681 82  bb.1:83    liveins: $eax84    $edi = MOV32r0 implicit-def dead $eflags, debug-location !1685    $esi = COPY killed renamable $eax, debug-location !1686 87  bb.2:88    RET 0, debug-location !1689...90