llvm-project/llvm/test/CodeGen/AArch64/GlobalISel/legalizer-combiner-zext-tru...

73 lines
3.0 KiB
YAML

# 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: 2
tracksRegLiveness: true
body: |
; CHECK-LABEL: name: zext_trunc_dead_inst_crash
; CHECK: bb.0:
; CHECK: successors: %bb.1(0x80000000)
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 46
; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 -33
; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 -65
; CHECK: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 26
; CHECK: [[DEF:%[0-9]+]]:_(s16) = G_IMPLICIT_DEF
; CHECK: bb.1:
; CHECK: successors: %bb.2(0x80000000)
; CHECK: [[PHI:%[0-9]+]]:_(s16) = G_PHI %33(s16), %bb.2, [[DEF]](s16), %bb.0
; CHECK: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
; CHECK: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[PHI]](s16)
; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[ANYEXT]], [[C4]]
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY [[C]](s32)
; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C4]]
; CHECK: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[AND]](s32), [[AND1]]
; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[ICMP]](s32)
; CHECK: [[DEF1:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[COPY1]], [[DEF1]]
; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[C1]](s32)
; CHECK: [[AND2:%[0-9]+]]:_(s32) = G_AND [[ANYEXT]], [[COPY2]]
; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[AND2]](s32)
; CHECK: [[COPY4:%[0-9]+]]:_(s32) = COPY [[C2]](s32)
; CHECK: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY3]], [[COPY4]]
; CHECK: [[COPY5:%[0-9]+]]:_(s32) = COPY [[ADD]](s32)
; CHECK: [[AND3:%[0-9]+]]:_(s32) = G_AND [[COPY5]], [[C4]]
; CHECK: [[COPY6:%[0-9]+]]:_(s32) = COPY [[C3]](s32)
; CHECK: [[AND4:%[0-9]+]]:_(s32) = G_AND [[COPY6]], [[C4]]
; CHECK: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[AND3]](s32), [[AND4]]
; CHECK: [[COPY7:%[0-9]+]]:_(s32) = COPY [[ICMP1]](s32)
; CHECK: [[COPY8:%[0-9]+]]:_(s32) = COPY [[OR]](s32)
; CHECK: [[OR1:%[0-9]+]]:_(s32) = G_OR [[COPY7]], [[COPY8]]
; CHECK: [[TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[OR1]](s32)
; CHECK: G_BRCOND [[TRUNC]](s1), %bb.2
; CHECK: bb.2:
; CHECK: successors: %bb.1(0x80000000)
; CHECK: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 64
; CHECK: [[TRUNC1:%[0-9]+]]:_(s16) = G_TRUNC [[C5]](s32)
; CHECK: 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
...