1# RUN: llc  -o -  -mtriple=thumbv7--windows-gnu -run-pass=greedy -run-pass=virtregrewriter %s | FileCheck %s
2--- |
3  target datalayout = "e-m:w-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
4  target triple = "thumbv7--windows-gnu"
5
6  define void @subregLiveThrough() { ret void }
7  define void @subregNotLiveThrough() { ret void }
8  define void @subregNotLiveThrough2() { ret void }
9
10...
11---
12# Check that we properly recognize that r1 is live through
13# the first subreg copy.
14# That will materialize as an implicit use of the big register
15# on that copy.
16# PR34107.
17#
18# CHECK-LABEL: name: subregLiveThrough
19name:            subregLiveThrough
20tracksRegLiveness: true
21registers:
22  - { id: 0, class: gprpair }
23body:             |
24  bb.0:
25    liveins: $r0, $r1
26
27    ; That copy is being coalesced so we should use a KILL
28    ; placeholder. If that's not a kill that means we probably
29    ; not coalescing %0 and $r0_r1 and thus we are not testing
30    ; the problematic code anymore.
31    ;
32    ; CHECK: $r0 = KILL $r0, implicit killed $r0_r1, implicit-def $r0_r1
33    ; CHECK-NEXT: $r1 = KILL $r1, implicit killed $r0_r1
34    undef %0.gsub_0 = COPY $r0
35    %0.gsub_1 = COPY $r1
36    tBX_RET 14, $noreg, implicit %0
37
38
39...
40
41---
42# Check that we properly recognize that r1 is *not* live through
43# the first subreg copy.
44# CHECK-LABEL: name: subregNotLiveThrough
45name:            subregNotLiveThrough
46tracksRegLiveness: true
47registers:
48  - { id: 0, class: gprpair }
49body:             |
50  bb.0:
51    liveins: $r0, $r1
52
53    ; r1 is not live through so check we are not implicitly using
54    ; the big register.
55    ; CHECK: $r0 = KILL $r0, implicit-def $r0_r1
56    ; CHECK-NEXT: tBX_RET
57    undef %0.gsub_0 = COPY $r0
58    tBX_RET 14, $noreg, implicit %0
59
60
61...
62
63---
64# Check that we properly recognize that r1 is *not* live through
65# the first subreg copy. It is defined by this copy, but is not
66# through.
67# CHECK-LABEL: name: subregNotLiveThrough2
68name:            subregNotLiveThrough2
69tracksRegLiveness: true
70registers:
71  - { id: 0, class: gprpair }
72body:             |
73  bb.0:
74    liveins: $r0, $r1
75
76    ; r1 is not live through so check we are not implicitly using
77    ; the big register.
78    ; CHECK: $r0 = KILL $r0, implicit-def $r1, implicit-def $r0_r1
79    ; CHECK-NEXT: tBX_RET
80    undef %0.gsub_0 = COPY $r0, implicit-def $r1
81    tBX_RET 14, $noreg, implicit %0
82
83
84...
85