brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.4 KiB · b503e0a Raw
159 lines · plain
1# RUN: llc %s -o - -mtriple=x86_64-unknown-unknown \2# RUN:    -experimental-debug-variable-locations \3# RUN:    -start-before=phi-node-elimination -stop-after=virtregrewriter \4# RUN:    | FileCheck %s5#6# Like phi-through-regalloc.mir, pass a PHI node into register allocation, and7# test that it correctly comes out, in a stack slot. In this test the desired8# value is a 16 bit copy of an argument, and the PHI register class is 16 bits.9# It's subsequently coalesced into a larger vreg, which is then spilt as a 3210# bit value.11# Test that the coalescing happens (32 bits stored and loaded), but that we12# record in the relevant DBG_PHI that the original value was 16 bits in size.13# This avoids later ambiguity about how large the value on the stack is.14 15--- |16  ; ModuleID = 'promoted.ll'17  source_filename = "test.c"18  target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"19  target triple = "x86_64-unknown-linux-gnu"20 21  define dso_local i32 @foo(i32 %bar, i32 %baz) !dbg !7 {22  entry:23    ret i32 0, !dbg !1924  }25 26  declare dso_local i32 @ext(i32)27 28  ; Function Attrs: nounwind readnone speculatable willreturn29  declare void @llvm.dbg.value(metadata, metadata, metadata)30 31  !llvm.dbg.cu = !{!0}32  !llvm.module.flags = !{!3, !4, !5}33  !llvm.ident = !{!6}34 35  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)36  !1 = !DIFile(filename: "test.c", directory: ".")37  !2 = !{}38  !3 = !{i32 7, !"Dwarf Version", i32 4}39  !4 = !{i32 2, !"Debug Info Version", i32 3}40  !5 = !{i32 1, !"wchar_size", i32 4}41  !6 = !{!"."}42  !7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)43  !8 = !DISubroutineType(types: !9)44  !9 = !{!10, !10, !10}45  !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)46  !11 = !DILocalVariable(name: "bar", arg: 1, scope: !7, file: !1, line: 2, type: !10)47  !12 = !DILocation(line: 0, scope: !7)48  !13 = !DILocalVariable(name: "baz", arg: 2, scope: !7, file: !1, line: 2, type: !10)49  !14 = !DILocalVariable(name: "either", scope: !7, file: !1, line: 3, type: !10)50  !15 = !DILocation(line: 4, column: 7, scope: !16)51  !16 = distinct !DILexicalBlock(scope: !7, file: !1, line: 4, column: 7)52  !17 = !DILocation(line: 4, column: 7, scope: !7)53  !18 = !DILocation(line: 0, scope: !16)54  !19 = !DILocation(line: 9, column: 3, scope: !7)55 56...57---58name:            foo59alignment:       1660tracksRegLiveness: true61debugInstrRef: true62registers:63  - { id: 0, class: gr16 }64  - { id: 1, class: gr32 }65  - { id: 2, class: gr32 }66  - { id: 3, class: gr32 }67  - { id: 4, class: gr32 }68liveins:69  - { reg: '$edi', virtual-reg: '%1' }70  - { reg: '$esi', virtual-reg: '%2' }71frameInfo:72  maxAlignment:    173  adjustsStack:    true74  hasCalls:        true75machineFunctionInfo: {}76body:             |77  ; CHECK-LABEL: bb.0:78  ; CHECK:       MOV32mr %stack.0, 1, $noreg, 0, $noreg, $edi79  bb.0:80    successors: %bb.2(0x50000000), %bb.1(0x30000000)81    liveins: $edi, $esi82 83    DBG_VALUE $edi, $noreg, !11, !DIExpression(), debug-location !1284    DBG_VALUE $esi, $noreg, !13, !DIExpression(), debug-location !1285    %2:gr32 = COPY killed $esi86    %1:gr32 = COPY killed $edi87    %5:gr16 = COPY %1.sub_16bit88    %6:gr16 = COPY %1.sub_16bit89    ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp, debug-location !1590    %3:gr32 = MOV32r0 implicit-def dead $eflags91    $edi = COPY killed %3, debug-location !1592    CALL64pcrel32 @ext, csr_64, implicit $rsp, implicit $ssp, implicit killed $edi, implicit-def $rsp, implicit-def $ssp, implicit-def $eax, debug-location !1593    ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp, debug-location !1594    %4:gr32 = COPY killed $eax, debug-location !1595    %10:gr32 = MOV32ri 096    %11:gr32 = MOV32ri 197    %12:gr32 = MOV32ri 298    %13:gr32 = MOV32ri 399    %14:gr32 = MOV32ri 4100    %15:gr32 = MOV32ri 5101    %16:gr32 = MOV32ri 6102    %17:gr32 = MOV32ri 7103    %18:gr32 = MOV32ri 8104    %19:gr32 = MOV32ri 9105    %20:gr32 = MOV32ri 10106    %21:gr32 = MOV32ri 11107    %22:gr32 = MOV32ri 12108    %23:gr32 = MOV32ri 13109    %24:gr32 = MOV32ri 14110    TEST32rr killed %4, %4, implicit-def $eflags, debug-location !15111    JCC_1 %bb.2, 5, implicit killed $eflags, debug-location !17112    JMP_1 %bb.1, debug-location !17113 114  bb.1:115    %30:gr32 = MOV32ri 0116    %31:gr32 = MOV32ri 1117    %32:gr32 = MOV32ri 2118    %33:gr32 = MOV32ri 3119    %34:gr32 = MOV32ri 4120    %35:gr32 = MOV32ri 5121    %36:gr32 = MOV32ri 6122    %37:gr32 = MOV32ri 7123    %38:gr32 = MOV32ri 8124    %39:gr32 = MOV32ri 9125    %40:gr32 = MOV32ri 10126    %41:gr32 = MOV32ri 11127    %42:gr32 = MOV32ri 12128    %43:gr32 = MOV32ri 13129    %44:gr32 = MOV32ri 14130 131    ; CHECK-LABEL: bb.2:132  bb.2:133    %0:gr16 = PHI %5, %bb.0, %6, %bb.1, debug-instr-number 1, debug-location !18134    %50:gr32 = PHI %10, %bb.0, %30, %bb.1, debug-location !18135    %51:gr32 = PHI %11, %bb.0, %31, %bb.1, debug-location !18136    %52:gr32 = PHI %12, %bb.0, %32, %bb.1, debug-location !18137    %53:gr32 = PHI %13, %bb.0, %33, %bb.1, debug-location !18138    %54:gr32 = PHI %14, %bb.0, %34, %bb.1, debug-location !18139    %55:gr32 = PHI %15, %bb.0, %35, %bb.1, debug-location !18140    %56:gr32 = PHI %16, %bb.0, %36, %bb.1, debug-location !18141    %57:gr32 = PHI %17, %bb.0, %37, %bb.1, debug-location !18142    %58:gr32 = PHI %18, %bb.0, %38, %bb.1, debug-location !18143    %59:gr32 = PHI %19, %bb.0, %39, %bb.1, debug-location !18144    %60:gr32 = PHI %20, %bb.0, %40, %bb.1, debug-location !18145    %61:gr32 = PHI %21, %bb.0, %41, %bb.1, debug-location !18146    %62:gr32 = PHI %22, %bb.0, %42, %bb.1, debug-location !18147    %63:gr32 = PHI %23, %bb.0, %43, %bb.1, debug-location !18148    %64:gr32 = PHI %24, %bb.0, %44, %bb.1, debug-location !18149 150    INLINEASM &"", 1, 12, %50, 12, %51, 12, %52, 12, %53, 12, %54, 12, %55, 12, %56, 12, %57, 12, %58, 12, %59, 12, %60, 12, %61, 12, %62, 12, %63, 12, %64151    DBG_INSTR_REF !14, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(1, 0), debug-location !12152    ; CHECK:      DBG_PHI %stack.0, 1, 16153    ; CHECK:      DBG_INSTR_REF {{.+}} dbg-instr-ref(1, 0)154    ; CHECK:      renamable $eax = MOV32rm %stack.0,155    $eax = COPY killed %0, debug-location !19156    RET 0, killed $eax, debug-location !19157 158...159