brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.6 KiB · b7df798 Raw
107 lines · plain
1# RUN: llc %s -o - -run-pass=machine-sink -mtriple=x86_64-- | FileCheck %s2# RUN: llc %s -o - -passes=machine-sink -mtriple=x86_64-- | FileCheck %s3# This is a copy of test/CodeGen/X86/MachineSink-DbgValue.ll, where we4# additionally test that when the MOV32rm defining %0 is sunk, it leaves5# an 'undef' DBG_VALUE behind to terminate earlier location ranges.6--- |7  target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"8  target triple = "x86_64-apple-macosx10.7.0"9  10  ; Function Attrs: nounwind readonly ssp uwtable11  define i32 @foo(i32 %i, ptr nocapture %c) !dbg !4 {12    call void @llvm.dbg.value(metadata i32 %i, metadata !9, metadata !DIExpression()), !dbg !1413    %ab = load i32, ptr %c, align 1, !dbg !1514    call void @llvm.dbg.value(metadata ptr %c, metadata !10, metadata !DIExpression()), !dbg !1615    call void @llvm.dbg.value(metadata i32 %ab, metadata !12, metadata !DIExpression()), !dbg !1516    %cd = icmp eq i32 %i, 42, !dbg !1717    br i1 %cd, label %bb1, label %bb2, !dbg !1718  19  bb1:                                              ; preds = %020    %gh = add nsw i32 %ab, 2, !dbg !1821    br label %bb2, !dbg !1822  23  bb2:                                              ; preds = %bb1, %024    %.0 = phi i32 [ %gh, %bb1 ], [ 0, %0 ]25    ret i32 %.0, !dbg !1926  }27  28  ; Function Attrs: nounwind readnone speculatable29  declare void @llvm.dbg.value(metadata, metadata, metadata)30  31  ; Function Attrs: nounwind32  declare void @llvm.stackprotector(ptr, ptr)33  34  !llvm.dbg.cu = !{!0}35  !llvm.module.flags = !{!3}36  37  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "Apple clang version 3.0 (tags/Apple/clang-211.10.1) (based on LLVM 3.0svn)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2)38  !1 = !DIFile(filename: "a.c", directory: "/private/tmp")39  !2 = !{}40  !3 = !{i32 1, !"Debug Info Version", i32 3}41  !4 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 2, type: !5, virtualIndex: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !8)42  !5 = !DISubroutineType(types: !6)43  !6 = !{!7}44  !7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)45  !8 = !{!9, !10, !12}46  !9 = !DILocalVariable(name: "i", arg: 1, scope: !4, file: !1, line: 2, type: !7)47  !10 = !DILocalVariable(name: "c", arg: 2, scope: !4, file: !1, line: 2, type: !11)48  !11 = !DIDerivedType(tag: DW_TAG_pointer_type, scope: !0, baseType: !7, size: 64, align: 64)49  !12 = !DILocalVariable(name: "a", scope: !13, file: !1, line: 3, type: !7)50  !13 = distinct !DILexicalBlock(scope: !4, file: !1, line: 2, column: 25)51  !14 = !DILocation(line: 2, column: 13, scope: !4)52  !15 = !DILocation(line: 3, column: 14, scope: !13)53  !16 = !DILocation(line: 2, column: 22, scope: !4)54  !17 = !DILocation(line: 4, column: 3, scope: !13)55  !18 = !DILocation(line: 5, column: 5, scope: !13)56  !19 = !DILocation(line: 7, column: 1, scope: !13)57  ; CHECK: ![[VARNUM:[0-9]+]] = !DILocalVariable(name: "a",58...59---60name:            foo61alignment:       462tracksRegLiveness: true63registers:       64  - { id: 0, class: gr32 }65  - { id: 1, class: gr32 }66  - { id: 2, class: gr32 }67  - { id: 3, class: gr32 }68  - { id: 4, class: gr64 }69  - { id: 5, class: gr32 }70  - { id: 6, class: gr32 }71liveins:         72  - { reg: '$edi', virtual-reg: '%3' }73  - { reg: '$rsi', virtual-reg: '%4' }74body:             |75  bb.0 (%ir-block.0):76    successors: %bb.1, %bb.277    liveins: $edi, $rsi78  ; CHECK-LABEL: bb.0 (%ir-block.0):79  ; CHECK:       DBG_VALUE $noreg, $noreg, ![[VARNUM]]80  81    DBG_VALUE $edi, $noreg, !9, !DIExpression(), debug-location !1482    DBG_VALUE $rsi, $noreg, !10, !DIExpression(), debug-location !1683    %4:gr64 = COPY $rsi84    DBG_VALUE %4, $noreg, !10, !DIExpression(), debug-location !1685    %3:gr32 = COPY $edi86    DBG_VALUE %3, $noreg, !9, !DIExpression(), debug-location !1487    %0:gr32 = MOV32rm %4, 1, $noreg, 0, $noreg, debug-location !15 :: (load (s32) from %ir.c, align 1)88    DBG_VALUE %0, $noreg, !12, !DIExpression(), debug-location !1589    %5:gr32 = MOV32r0 implicit-def dead $eflags90    %6:gr32 = SUB32ri8 %3, 42, implicit-def $eflags, debug-location !1791    JCC_1 %bb.2, 5, implicit $eflags, debug-location !1792    JMP_1 %bb.1, debug-location !1793  94  bb.1.bb1:95  ; CHECK-LABEL: bb.1.bb1:96  ; CHECK:       %[[VREG:[0-9]+]]:gr32 = MOV32rm97  ; CHECK-NEXT:  DBG_VALUE %[[VREG]], $noreg, ![[VARNUM]]98  ; CHECK-NEXT:  ADD32ri899    %1:gr32 = nsw ADD32ri8 %0, 2, implicit-def dead $eflags, debug-location !18100  101  bb.2.bb2:102    %2:gr32 = PHI %5, %bb.0, %1, %bb.1103    $eax = COPY %2, debug-location !19104    RET 0, $eax, debug-location !19105 106...107