1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=s390x-linux-gnu -mcpu=z13 -O3 -pre-RA-sched=list-ilp -systemz-subreg-liveness -stress-sched -terminal-rule %s -o - | FileCheck %s
3; This test used to fail because we were creating empty subranges
4; instead of subranges with dead defs while rematerializing values
5; during coalescing.
6;
7; PR46154
8; REQUIRES: asserts
9
10@g_39 = external dso_local unnamed_addr global i64, align 8
11@g_151 = external dso_local global i32, align 4
12@g_222 = external dso_local unnamed_addr global [7 x [10 x i8]], align 2
13
14define void @main() {
15; CHECK-LABEL: main:
16; CHECK:       # %bb.0:
17; CHECK-NEXT:    lhi %r0, 1
18; CHECK-NEXT:    larl %r1, g_151
19; CHECK-NEXT:    lghi %r3, 0
20; CHECK-NEXT:    chi %r0, 0
21; CHECK-NEXT:    locghile %r3, 1
22; CHECK-NEXT:    o %r0, 0(%r1)
23; CHECK-NEXT:    dsgfr %r2, %r0
24; CHECK-NEXT:    larl %r1, g_222
25; CHECK-NEXT:    lghi %r5, 0
26; CHECK-NEXT:    stgrl %r2, g_39
27; CHECK-NEXT:    stc %r5, 19(%r1)
28; CHECK-NEXT:    br %r14
29  %tmp = load i32, i32* @g_151, align 4
30  %tmp3 = or i32 %tmp, 1
31  %tmp4 = sext i32 %tmp3 to i64
32  %tmp5 = srem i64 0, %tmp4
33  %tmp6 = trunc i64 %tmp5 to i8
34  store i8 %tmp6, i8* getelementptr inbounds ([7 x [10 x i8]], [7 x [10 x i8]]* @g_222, i64 0, i64 1, i64 9), align 1
35  %tmp7 = icmp slt i16 undef, 1
36  %tmp8 = zext i1 %tmp7 to i64
37  %tmp9 = srem i64 %tmp8, %tmp4
38  store i64 %tmp9, i64* @g_39, align 8
39  ret void
40}
41
42