1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -verify-coalescing -run-pass=register-coalescer -o - %s | FileCheck %s
4 # %2 has an undef read in %bb.3, and this IR wouldn't be valid if it
5 # was a real read. After merging %2 into %0, we need to replace the
6 # copy of undef with an implicit_def since the copy introduced a new
10 name: coalesce_into_undef_copy
11 tracksRegLiveness: true
13 scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
14 stackPtrOffsetReg: '$sgpr32'
16 ; CHECK-LABEL: name: coalesce_into_undef_copy
18 ; CHECK-NEXT: successors: %bb.1(0x80000000)
20 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vreg_128_align2 = COPY undef %1:sgpr_128, implicit $exec
21 ; CHECK-NEXT: S_BRANCH %bb.1
24 ; CHECK-NEXT: successors: %bb.2(0x80000000)
26 ; CHECK-NEXT: dead [[DEF:%[0-9]+]]:vreg_128_align2 = IMPLICIT_DEF
27 ; CHECK-NEXT: [[COPY:%[0-9]+]].sub0:vreg_128_align2 = IMPLICIT_DEF
30 ; CHECK-NEXT: successors: %bb.2(0x80000000)
32 ; CHECK-NEXT: dead [[V_INDIRECT_REG_READ_GPR_IDX_B32_V4_:%[0-9]+]]:vgpr_32 = V_INDIRECT_REG_READ_GPR_IDX_B32_V4 [[COPY]], undef %5:sgpr_32, 11, implicit-def $m0, implicit $m0, implicit $exec
33 ; CHECK-NEXT: S_BRANCH %bb.2
36 ; CHECK-NEXT: successors: %bb.1(0x40000000), %bb.4(0x40000000)
38 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vreg_128_align2 = IMPLICIT_DEF
39 ; CHECK-NEXT: S_CBRANCH_EXECNZ %bb.1, implicit $exec
43 %0:vreg_128_align2 = COPY undef %1:sgpr_128, implicit $exec
47 %2:vreg_128_align2 = IMPLICIT_DEF
48 %3:vreg_128_align2 = COPY killed %0
49 %3.sub0:vreg_128_align2 = IMPLICIT_DEF
52 dead %5:vgpr_32 = V_INDIRECT_REG_READ_GPR_IDX_B32_V4 %3, undef %6:sgpr_32, 11, implicit-def $m0, implicit $m0, implicit $exec
56 %0:vreg_128_align2 = COPY undef %2
57 S_CBRANCH_EXECNZ %bb.1, implicit $exec