1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple aarch64 -run-pass=legalizer -verify-machineinstrs %s -o - | FileCheck %s
4 # This test checks we don't crash when doing zext(trunc) legalizer combines.
6 name: zext_trunc_dead_inst_crash
8 tracksRegLiveness: true
10 ; CHECK-LABEL: name: zext_trunc_dead_inst_crash
12 ; CHECK-NEXT: successors: %bb.1(0x80000000)
14 ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(s16) = G_IMPLICIT_DEF
17 ; CHECK-NEXT: successors: %bb.2(0x80000000)
19 ; CHECK-NEXT: [[PHI:%[0-9]+]]:_(s16) = G_PHI %33(s16), %bb.2, [[DEF]](s16), %bb.0
20 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[PHI]](s16)
21 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
22 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ANYEXT]], [[C]]
23 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 46
24 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[AND]](s32), [[C1]]
25 ; CHECK-NEXT: [[DEF1:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
26 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s32) = G_OR [[ICMP]], [[DEF1]]
27 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY [[ANYEXT]](s32)
28 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 -33
29 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C2]]
30 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 -65
31 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[AND1]], [[C3]]
32 ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s32) = G_AND [[ADD]], [[C]]
33 ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 26
34 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[AND2]](s32), [[C4]]
35 ; CHECK-NEXT: [[OR1:%[0-9]+]]:_(s32) = G_OR [[ICMP1]], [[OR]]
36 ; CHECK-NEXT: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
37 ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s32) = G_AND [[OR1]], [[C5]]
38 ; CHECK-NEXT: G_BRCOND [[AND3]](s32), %bb.2
41 ; CHECK-NEXT: successors: %bb.1(0x80000000)
43 ; CHECK-NEXT: [[C6:%[0-9]+]]:_(s16) = G_CONSTANT i16 64
44 ; CHECK-NEXT: G_BR %bb.1
46 %1:_(s8) = G_CONSTANT i8 46
47 %3:_(s1) = G_IMPLICIT_DEF
48 %5:_(s8) = G_CONSTANT i8 -33
49 %7:_(s8) = G_CONSTANT i8 -65
50 %9:_(s8) = G_CONSTANT i8 26
51 %13:_(s8) = G_IMPLICIT_DEF
54 %0:_(s8) = G_PHI %12(s8), %bb.4, %13(s8), %bb.1
55 %2:_(s1) = G_ICMP intpred(eq), %0(s8), %1
56 %4:_(s1) = G_OR %2, %3
57 %6:_(s8) = G_AND %0, %5
58 %8:_(s8) = G_ADD %6, %7
59 %10:_(s1) = G_ICMP intpred(ult), %8(s8), %9
60 %11:_(s1) = G_OR %10, %4
61 G_BRCOND %11(s1), %bb.4
64 %12:_(s8) = G_CONSTANT i8 64