| # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py |
| # RUN: llc -mtriple aarch64 -run-pass=legalizer -verify-machineinstrs %s -o - | FileCheck %s |
| |
| # This test checks we don't crash when doing zext(trunc) legalizer combines. |
| --- |
| name: zext_trunc_dead_inst_crash |
| alignment: 4 |
| tracksRegLiveness: true |
| body: | |
| ; CHECK-LABEL: name: zext_trunc_dead_inst_crash |
| ; CHECK: bb.0: |
| ; CHECK-NEXT: successors: %bb.1(0x80000000) |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(s16) = G_IMPLICIT_DEF |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: bb.1: |
| ; CHECK-NEXT: successors: %bb.2(0x80000000) |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[PHI:%[0-9]+]]:_(s16) = G_PHI %33(s16), %bb.2, [[DEF]](s16), %bb.0 |
| ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[PHI]](s16) |
| ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255 |
| ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ANYEXT]], [[C]] |
| ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 46 |
| ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[AND]](s32), [[C1]] |
| ; CHECK-NEXT: [[DEF1:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF |
| ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s32) = G_OR [[ICMP]], [[DEF1]] |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY [[ANYEXT]](s32) |
| ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 -33 |
| ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C2]] |
| ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 -65 |
| ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[AND1]], [[C3]] |
| ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s32) = G_AND [[ADD]], [[C]] |
| ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 26 |
| ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[AND2]](s32), [[C4]] |
| ; CHECK-NEXT: [[OR1:%[0-9]+]]:_(s32) = G_OR [[ICMP1]], [[OR]] |
| ; CHECK-NEXT: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 |
| ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s32) = G_AND [[OR1]], [[C5]] |
| ; CHECK-NEXT: G_BRCOND [[AND3]](s32), %bb.2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: bb.2: |
| ; CHECK-NEXT: successors: %bb.1(0x80000000) |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[C6:%[0-9]+]]:_(s16) = G_CONSTANT i16 64 |
| ; CHECK-NEXT: G_BR %bb.1 |
| bb.1: |
| %1:_(s8) = G_CONSTANT i8 46 |
| %3:_(s1) = G_IMPLICIT_DEF |
| %5:_(s8) = G_CONSTANT i8 -33 |
| %7:_(s8) = G_CONSTANT i8 -65 |
| %9:_(s8) = G_CONSTANT i8 26 |
| %13:_(s8) = G_IMPLICIT_DEF |
| |
| bb.2: |
| %0:_(s8) = G_PHI %12(s8), %bb.4, %13(s8), %bb.1 |
| %2:_(s1) = G_ICMP intpred(eq), %0(s8), %1 |
| %4:_(s1) = G_OR %2, %3 |
| %6:_(s8) = G_AND %0, %5 |
| %8:_(s8) = G_ADD %6, %7 |
| %10:_(s1) = G_ICMP intpred(ult), %8(s8), %9 |
| %11:_(s1) = G_OR %10, %4 |
| G_BRCOND %11(s1), %bb.4 |
| |
| bb.4: |
| %12:_(s8) = G_CONSTANT i8 64 |
| G_BR %bb.2 |
| |
| ... |