brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.3 KiB · 6c0c0e2 Raw
211 lines · plain
1# RUN: llc -run-pass wasm-reg-coloring %s -o - | FileCheck %s2 3# Tests for invalid DBG_VALUE set to undef after in RegColoring4 5--- |6  target triple = "wasm32-unknown-unknown"7 8  declare void @use(i32)9 10  define void @coalesce_test_0() {11    call void @llvm.dbg.value(metadata i32 0, metadata !5, metadata !DIExpression()), !dbg !1012    ret void13  }14  define void @coalesce_test_1() {15    unreachable16  }17  define void @coalesce_test_2() {18    unreachable19  }20  define void @coalesce_test_3() {21    unreachable22  }23  declare void @llvm.dbg.value(metadata, metadata, metadata)24 25  !llvm.dbg.cu = !{!0}26  !llvm.module.flags = !{!2, !3, !4}27 28  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, emissionKind: FullDebug)29  !1 = !DIFile(filename: "test.c", directory: "")30  !2 = !{i32 7, !"Dwarf Version", i32 5}31  !3 = !{i32 2, !"Debug Info Version", i32 3}32  !4 = !{i32 1, !"wchar_size", i32 4}33  !5 = !DILocalVariable(name: "var_a", scope: !6, file: !1, line: 2, type: !9)34  !6 = distinct !DISubprogram(name: "coalesce_test_0", scope: !1, file: !1, line: 1, type: !7, scopeLine: 1, unit: !0)35  !7 = !DISubroutineType(types: !8)36  !8 = !{null}37  !9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)38  !10 = !DILocation(line: 0, scope: !6)39  !11 = !DILocalVariable(name: "var_b", scope: !6, file: !1, line: 2, type: !9)40  !12 = !DILocalVariable(name: "var_c", scope: !6, file: !1, line: 2, type: !9)41...42 43---44# %0 and %1 are coalesced in this test45# CHECK-LABEL: name: coalesce_test_046name: coalesce_test_047liveins:48  - { reg: '$arguments' }49tracksRegLiveness: true50body: |51  bb.0:52    liveins: $arguments53    %0:i32 = CONST_I32 0, implicit-def $arguments54    ; This should remain the same55    DBG_VALUE %0, $noreg, !5, !DIExpression(), debug-location !1056    ; This should be set to undef, because this is within %0's live range57    DBG_VALUE %1, $noreg, !10, !DIExpression(), debug-location !1058    CALL @use, %0, implicit-def $arguments59    NOP implicit-def $arguments60    %1:i32 = CONST_I32 1, implicit-def $arguments61    ; This should be set to undef, because this is within %1's live range62    DBG_VALUE %0, $noreg, !5, !DIExpression(), debug-location !1063    ; This should remain the same64    DBG_VALUE %1, $noreg, !10, !DIExpression(), debug-location !1065    CALL @use, %1, implicit-def $arguments66    RETURN implicit-def $arguments67 68  ; CHECK:      %0:i32 = CONST_I32 069  ; CHECK-NEXT: DBG_VALUE %0, $noreg70  ; CHECK-NEXT: DBG_VALUE $noreg, $noreg71  ; CHECK-NEXT: CALL @use, %072  ; CHECK-NEXT: NOP73  ; CHECK-NEXT: %0:i32 = CONST_I32 174  ; CHECK-NEXT: DBG_VALUE $noreg, $noreg75  ; CHECK-NEXT: DBG_VALUE %0, $noreg76  ; CHECK-NEXT: CALL @use, %077  ; CHECK-NEXT: RETURN implicit-def $arguments78...79 80---81# A similar test with above, only with more consecutive DBG_VALUEs. These82# consecutive DBG_VALUEs will be handled with a quick last result check.83# CHECK-LABEL: name: coalesce_test_184name: coalesce_test_185liveins:86  - { reg: '$arguments' }87tracksRegLiveness: true88body: |89  bb.0:90    liveins: $arguments91    %0:i32 = CONST_I32 0, implicit-def $arguments92    ; All DBG_VALUE %1s in %0's live range will be set to undef93    DBG_VALUE %1, $noreg, !10, !DIExpression(), debug-location !1094    DBG_VALUE %1, $noreg, !10, !DIExpression(), debug-location !1095    DBG_VALUE %0, $noreg, !5, !DIExpression(), debug-location !1096    DBG_VALUE %1, $noreg, !10, !DIExpression(), debug-location !1097    CALL @use, %0, implicit-def $arguments98    NOP implicit-def $arguments99    %1:i32 = CONST_I32 1, implicit-def $arguments100    ; All DBG_VALUE %0s in %1's live range will be set to undef101    DBG_VALUE %0, $noreg, !5, !DIExpression(), debug-location !10102    DBG_VALUE %0, $noreg, !5, !DIExpression(), debug-location !10103    DBG_VALUE %1, $noreg, !10, !DIExpression(), debug-location !10104    DBG_VALUE %0, $noreg, !5, !DIExpression(), debug-location !10105    CALL @use, %1, implicit-def $arguments106    RETURN implicit-def $arguments107 108  ; CHECK:      %0:i32 = CONST_I32 0109  ; CHECK-NEXT: DBG_VALUE $noreg, $noreg110  ; CHECK-NEXT: DBG_VALUE $noreg, $noreg111  ; CHECK-NEXT: DBG_VALUE %0, $noreg112  ; CHECK-NEXT: DBG_VALUE $noreg, $noreg113  ; CHECK-NEXT: CALL @use, %0114  ; CHECK-NEXT: NOP115  ; CHECK-NEXT: %0:i32 = CONST_I32 1116  ; CHECK-NEXT: DBG_VALUE $noreg, $noreg117  ; CHECK-NEXT: DBG_VALUE $noreg, $noreg118  ; CHECK-NEXT: DBG_VALUE %0, $noreg119  ; CHECK-NEXT: DBG_VALUE $noreg, $noreg120  ; CHECK-NEXT: CALL @use, %0121  ; CHECK-NEXT: RETURN implicit-def $arguments122...123 124---125# The same with coalesce_test_0, but the two registers' live ranges are in126# different BBs.127# CHECK-LABEL: name: coalesce_test_2128name: coalesce_test_2129liveins:130  - { reg: '$arguments' }131tracksRegLiveness: true132body: |133  bb.0:134    liveins: $arguments135    %0:i32 = CONST_I32 0, implicit-def $arguments136    DBG_VALUE %0, $noreg, !5, !DIExpression(), debug-location !10137    DBG_VALUE %1, $noreg, !10, !DIExpression(), debug-location !10138    CALL @use, %0, implicit-def $arguments139    BR %bb.1, implicit-def $arguments140 141  ; CHECK: bb.0:142  ; CHECK:      %0:i32 = CONST_I32 0143  ; CHECK-NEXT: DBG_VALUE %0, $noreg144  ; CHECK-NEXT: DBG_VALUE $noreg, $noreg145  ; CHECK-NEXT: CALL @use, %0146  ; CHECK-NEXT: BR %bb.1147 148  bb.1:149    %1:i32 = CONST_I32 1, implicit-def $arguments150    DBG_VALUE %0, $noreg, !5, !DIExpression(), debug-location !10151    DBG_VALUE %1, $noreg, !10, !DIExpression(), debug-location !10152    CALL @use, %1, implicit-def $arguments153    RETURN implicit-def $arguments154 155  ; CHECK: bb.1:156  ; CHECK-NEXT: %0:i32 = CONST_I32 1157  ; CHECK-NEXT: DBG_VALUE $noreg, $noreg158  ; CHECK-NEXT: DBG_VALUE %0, $noreg159  ; CHECK-NEXT: CALL @use, %0160  ; CHECK-NEXT: RETURN implicit-def $arguments161...162 163---164# Same test with three registers.165# CHECK-LABEL: name: coalesce_test_3166name: coalesce_test_3167liveins:168  - { reg: '$arguments' }169tracksRegLiveness: true170body: |171  bb.0:172    liveins: $arguments173    %0:i32 = CONST_I32 0, implicit-def $arguments174    DBG_VALUE %0, $noreg, !5, !DIExpression(), debug-location !10175    DBG_VALUE %1, $noreg, !10, !DIExpression(), debug-location !10176    DBG_VALUE %2, $noreg, !11, !DIExpression(), debug-location !10177    CALL @use, %0, implicit-def $arguments178    NOP implicit-def $arguments179    %1:i32 = CONST_I32 1, implicit-def $arguments180    DBG_VALUE %0, $noreg, !5, !DIExpression(), debug-location !10181    DBG_VALUE %1, $noreg, !10, !DIExpression(), debug-location !10182    DBG_VALUE %2, $noreg, !11, !DIExpression(), debug-location !10183    CALL @use, %1, implicit-def $arguments184    NOP implicit-def $arguments185    %2:i32 = CONST_I32 2, implicit-def $arguments186    DBG_VALUE %0, $noreg, !5, !DIExpression(), debug-location !10187    DBG_VALUE %1, $noreg, !10, !DIExpression(), debug-location !10188    DBG_VALUE %2, $noreg, !11, !DIExpression(), debug-location !10189    CALL @use, %2, implicit-def $arguments190    RETURN implicit-def $arguments191 192  ; CHECK:      %0:i32 = CONST_I32 0193  ; CHECK-NEXT: DBG_VALUE %0, $noreg194  ; CHECK-NEXT: DBG_VALUE $noreg, $noreg195  ; CHECK-NEXT: DBG_VALUE $noreg, $noreg196  ; CHECK-NEXT: CALL @use, %0197  ; CHECK-NEXT: NOP198  ; CHECK-NEXT: %0:i32 = CONST_I32 1199  ; CHECK-NEXT: DBG_VALUE $noreg, $noreg200  ; CHECK-NEXT: DBG_VALUE %0, $noreg201  ; CHECK-NEXT: DBG_VALUE $noreg, $noreg202  ; CHECK-NEXT: CALL @use, %0203  ; CHECK-NEXT: NOP204  ; CHECK-NEXT: %0:i32 = CONST_I32 2205  ; CHECK-NEXT: DBG_VALUE $noreg, $noreg206  ; CHECK-NEXT: DBG_VALUE $noreg, $noreg207  ; CHECK-NEXT: DBG_VALUE %0, $noreg208  ; CHECK-NEXT: CALL @use, %0209  ; CHECK-NEXT: RETURN implicit-def $arguments210---211