brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.5 KiB · de69a6f Raw
110 lines · plain
1# RUN: llc -start-after=phi-node-elimination -stop-after=virtregrewriter %s -mtriple=x86_64-unknown-unknown -o - | FileCheck %s2#3# Test that when a livedebugvars interval is split, DBG_VALUE_LISTs are created4# with the correct operands and exprs. Force values to be moved around between5# registers and stack through inline asm blocks that clobber things.6#7# CHECK-LABEL: bb.0.entry:8# CHECK:       $rbx = COPY $rsi9# CHECK-NEXT:  MOV64mr %stack.0, 1, $noreg, 0, $noreg, $rdi10# CHECK-NEXT:  DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_deref, DW_OP_LLVM_arg, 1, DW_OP_plus), %stack.0, $rbx,11# CHECK-NEXT:  INLINEASM12# CHECK-NEXT:  $rax = MOV64rm %stack.0,13# CHECK-NEXT:  DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rax, $rbx,14# CHECK-NEXT:  CALL64pcrel32 @foo15# CHECK-NEXT:  DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_deref, DW_OP_LLVM_arg, 1, DW_OP_plus), %stack.0, $rbx,16# CHECK-NEXT:  $rcx = COPY killed renamable $rbx17# CHECK-NEXT:  DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_deref, DW_OP_LLVM_arg, 1, DW_OP_plus), %stack.0, $rcx,18# CHECK-NEXT:  INLINEASM19# CHECK-NEXT:  $rax = MOV64rm %stack.020# CHECK-NEXT:  DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rax, $rcx,21 22--- |23  ; ModuleID = 'tmp.ll'24  source_filename = "tmp.ll"25  target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"26 27  %struct.a = type { i32 }28 29  ; Function Attrs: nounwind ssp30  define i32 @bar(ptr nocapture %b, i32 %shoes) !dbg !4 {31  entry:32    tail call void @llvm.dbg.value(metadata i32 %shoes, metadata !9, metadata !DIExpression()), !dbg !1633    %tmp1 = getelementptr inbounds %struct.a, ptr %b, i64 0, i32 0, !dbg !1734    br label %bb335 36  bb1:                                              ; preds = %bb237    tail call void @llvm.dbg.value(metadata i32 %shoes, metadata !9, metadata !DIExpression()), !dbg !1638    %add = add nsw i32 %tmp2, 1, !dbg !1839    br label %exit40 41  bb2:                                              ; preds = %bb342    tail call void @llvm.dbg.value(metadata i32 %tmp2, metadata !14, metadata !DIExpression()), !dbg !1743    %call = tail call i32 (...) @foo(i32 %tmp2), !dbg !1944    br label %bb145 46  bb3:                                              ; preds = %entry47    %tmp2 = load i32, ptr %tmp1, align 4, !dbg !1748    br label %bb249 50  exit:                                             ; preds = %bb151    ret i32 %shoes, !dbg !1852  }53 54  declare i32 @foo(...)55 56  ; Function Attrs: nounwind readnone speculatable willreturn57  declare void @llvm.dbg.value(metadata, metadata, metadata)58 59  !llvm.dbg.cu = !{!0}60  !llvm.module.flags = !{!3}61 62  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 2.9 (trunk 122997)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2)63  !1 = !DIFile(filename: "bar.c", directory: "/private/tmp")64  !2 = !{}65  !3 = !{i32 1, !"Debug Info Version", i32 3}66  !4 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 5, type: !5, virtualIndex: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !8)67  !5 = !DISubroutineType(types: !6)68  !6 = !{!7}69  !7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)70  !8 = !{!9, !14}71  !9 = !DILocalVariable(name: "b", arg: 1, scope: !4, file: !1, line: 5, type: !10)72  !10 = !DIDerivedType(tag: DW_TAG_pointer_type, scope: !0, baseType: !11, size: 64, align: 64)73  !11 = !DICompositeType(tag: DW_TAG_structure_type, name: "a", scope: !0, file: !1, line: 1, size: 32, align: 32, elements: !12)74  !12 = !{!13}75  !13 = !DIDerivedType(tag: DW_TAG_member, name: "c", scope: !1, file: !1, line: 2, baseType: !7, size: 32, align: 32)76  !14 = !DILocalVariable(name: "x", scope: !15, file: !1, line: 6, type: !7)77  !15 = distinct !DILexicalBlock(scope: !4, file: !1, line: 5, column: 22)78  !16 = !DILocation(line: 5, column: 19, scope: !4)79  !17 = !DILocation(line: 6, column: 14, scope: !15)80  !18 = !DILocation(line: 8, column: 2, scope: !15)81  !19 = !DILocation(line: 7, column: 2, scope: !15)82 83...84---85name:            bar86tracksRegLiveness: true87body:             |88  bb.0.entry:89    liveins: $rdi, $rsi90 91    %4:gr64= COPY $rsi92    %2:gr64 = COPY $rdi93    DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), %2, %4, debug-location !1794    %3:gr64 = COPY killed %295    %5:gr64 = COPY killed %496 97    ; Force allocation into $rax and $rbx98    INLINEASM &"", 1, 12, implicit-def dead $rcx, 12, implicit-def dead $rdx, 12, implicit-def dead $rsi, 12, implicit-def dead $rdi, 12, implicit-def $rbp, 12, implicit-def dead $r8, 12, implicit-def dead $r9, 12, implicit-def dead $r10, 12, implicit-def dead $r11, 12, implicit-def dead $r12, 12, implicit-def dead $r13, 12, implicit-def dead $r14, 12, implicit-def dead $r15, 12, !18, debug-location !1799 100    ; Force a use of these two registers.101    CALL64pcrel32 @foo, csr_64, implicit $rsp, implicit $ssp, implicit %3, implicit %5102 103    ; Now make the register allocator move them to rcx and rdx!104    INLINEASM &"", 1, 12, implicit-def dead $rax, 12, implicit-def dead $rbx, 12, implicit-def dead $rsi, 12, implicit-def dead $rdi, 12, implicit-def $rbp, 12, implicit-def dead $r8, 12, implicit-def dead $r9, 12, implicit-def dead $r10, 12, implicit-def dead $r11, 12, implicit-def dead $r12, 12, implicit-def dead $r13, 12, implicit-def dead $r14, 12, implicit-def dead $r15, 12, !18, debug-location !17105 106    CALL64pcrel32 @foo, csr_64, implicit $rsp, implicit $ssp, implicit %3, implicit %5107 108    RET64109...110