1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple s390x-ibm-linux -mcpu=z13 -systemz-subreg-liveness -verify-machineinstrs -start-before simple-register-coalescing -stop-after greedy -o - %s | FileCheck %s
4 # Check that when we split the live-range with several active lanes
5 # as part of the live-range update, we correctly eliminate the VNI from
8 # In this specific test, the register coalescer will:
9 # 1. Merge %0 with %1, creating a live-range for the full value subreg_l32 + subreg_h32
10 # (actually %0 gets merge with %1 via rematerialization, and technically %0 and %1
11 # remain two different live-ranges.)
12 # 2. Merge %2 with %1 triggering a split into the subreg_l32 + subreg_h32 ranges, since
13 # %2 only touches subreg_l32. As part of the split the subrange covering subreg_h32
14 # must contain only the VNI for the high part (i.e., the one tied with the remaaat of %0).
15 # This used to be broken and trigger a machine verifier error, because we were not
16 # clearing the dead value w.r.t. lanes when doing the splitting. I.e., we were ending
17 # with a subrange referring a value that did not define that lane.
22 tracksRegLiveness: true
26 ; CHECK-LABEL: name: main
27 ; CHECK: [[LGHI:%[0-9]+]]:gr64bit = LGHI 43
28 ; CHECK: [[LGHI1:%[0-9]+]]:gr64bit = LGHI 43
29 ; CHECK: [[LGHI1]].subreg_l32:gr64bit = MSR [[LGHI1]].subreg_l32, [[LGHI1]].subreg_l32
30 ; CHECK: [[LGHI1]].subreg_l32:gr64bit = AHIMux [[LGHI1]].subreg_l32, 9, implicit-def dead $cc
31 ; CHECK: undef %3.subreg_l64:gr128bit = LGFI -245143785, implicit [[LGHI1]].subreg_l32
32 ; CHECK: [[DLGR:%[0-9]+]]:gr128bit = DLGR [[DLGR]], [[LGHI]]
33 ; CHECK: Return implicit [[DLGR]]
35 %1:gr32bit = COPY %0.subreg_l32
36 %1:gr32bit = MSR %1, %1
37 %2:gr32bit = COPY killed %1
38 %2:gr32bit = AHIMux killed %2, 9, implicit-def dead $cc
39 undef %3.subreg_l64:gr128bit = LGFI -245143785, implicit killed %2
40 %3:gr128bit = DLGR %3:gr128bit, killed %0
41 Return implicit killed %3
45 # Make sure the compiler does not choke on VNIs that don't
46 # an explicit MI as definition.
47 # In that specific example, this is the PHI not explicitly
48 # represented for the value carried by %7.
51 tracksRegLiveness: true
54 ; CHECK-LABEL: name: segfault
56 ; CHECK: successors: %bb.1(0x80000000)
57 ; CHECK: [[LGHI:%[0-9]+]]:addr64bit = LGHI 0
59 ; CHECK: successors: %bb.1(0x80000000)
60 ; CHECK: ADJCALLSTACKDOWN 0, 0
61 ; CHECK: [[LGFR:%[0-9]+]]:gr64bit = LGFR [[LGHI]].subreg_l32
62 ; CHECK: $r2d = LGHI 123
63 ; CHECK: $r3d = LGHI 0
64 ; CHECK: $r4d = LGHI 0
65 ; CHECK: $r5d = COPY [[LGFR]]
66 ; CHECK: KILL killed $r2d, killed $r3d, killed $r4d, $r5d, csr_systemz, implicit-def dead $r14d, implicit-def dead $cc
67 ; CHECK: ADJCALLSTACKUP 0, 0
68 ; CHECK: [[LGHI]]:addr64bit = nuw nsw LA [[LGHI]], 1, $noreg
71 successors: %bb.1(0x80000000)
75 %7:addr64bit = COPY %2
78 successors: %bb.1(0x80000000)
80 %0:addr64bit = COPY killed %7
82 %3:gr32bit = COPY %0.subreg_l32
83 %4:gr64bit = LGFR killed %3
88 KILL killed $r2d, killed $r3d, killed $r4d, killed $r5d, csr_systemz, implicit-def dead $r14d, implicit-def dead $cc
90 %1:gr64bit = nuw nsw LA killed %0, 1, $noreg
91 %7:addr64bit = COPY killed %1