1# RUN: llc -o -  -march=amdgcn  -run-pass mir-canonicalizer -verify-machineinstrs %s | FileCheck %s
2# RUN: llc -o -  -march=amdgcn  -run-pass mir-canonicalizer -mir-vreg-namer-use-stable-hash -verify-machineinstrs %s | FileCheck %s
3
4# This tests for the itereator invalidation fix (reviews.llvm.org/D62713)
5...
6---
7name: foo
8body:             |
9  bb.0:
10    ; CHECK-LABEL: name: foo
11    ; CHECK: %bb0_{{[0-9]+}}__1:sreg_32_xm0 = S_MOV_B32 61440
12    ; CHECK: %bb0_{{[0-9]+}}__1:sreg_32_xm0 = S_MOV_B32 0
13    ; CHECK: %bb0_{{[0-9]+}}__1:vgpr_32 = COPY $vgpr0
14    ; CHECK: %bb0_{{[0-9]+}}__1:sgpr_64 = COPY $sgpr0_sgpr1
15    ; CHECK: %bb0_{{[0-9]+}}__1:sreg_64_xexec = S_LOAD_DWORDX2_IMM %bb0_{{[0-9]+}}__1, 9, 0, 0
16    ; CHECK: %bb0_{{[0-9]+}}__1:sreg_64_xexec = S_LOAD_DWORDX2_IMM %bb0_{{[0-9]+}}__1, 11, 0, 0
17    ; CHECK: %bb0_{{[0-9]+}}__1:vgpr_32 = COPY %bb0_{{[0-9]+}}__1
18    ; CHECK: %bb0_{{[0-9]+}}__1:vgpr_32 = COPY %bb0_{{[0-9]+}}__1
19    ; CHECK: %bb0_{{[0-9]+}}__2:vgpr_32 = COPY %bb0_{{[0-9]+}}__1
20    ; CHECK: %bb0_{{[0-9]+}}__1:vreg_64 = REG_SEQUENCE %bb0_{{[0-9]+}}__1, %subreg.sub0, %bb0_{{[0-9]+}}__1, %subreg.sub1
21    ; CHECK: %bb0_{{[0-9]+}}__1:sgpr_128 = REG_SEQUENCE %bb0_{{[0-9]+}}__1, %subreg.sub0, %bb0_{{[0-9]+}}__1, %subreg.sub1, %bb0_{{[0-9]+}}__1, %subreg.sub2, %bb0_{{[0-9]+}}__2, %subreg.sub3
22    ; CHECK: BUFFER_STORE_DWORD_ADDR64 %bb0_{{[0-9]+}}__1, %bb0_{{[0-9]+}}__1, %bb0_{{[0-9]+}}__1, 0, 0, 0, 0, 0, 0, 0, implicit $exec
23    ; CHECK: S_ENDPGM 0
24    %10:sreg_32_xm0 = S_MOV_B32 61440
25    %11:sreg_32_xm0 = S_MOV_B32 0
26    %3:vgpr_32 = COPY $vgpr0
27
28    %vreg123_0:vgpr_32 = COPY %3
29    %0:sgpr_64 = COPY $sgpr0_sgpr1
30    %vreg123_1:vgpr_32 = COPY %11
31    %27:vreg_64 = REG_SEQUENCE %vreg123_0, %subreg.sub0, %vreg123_1, %subreg.sub1
32    %4:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0, 9, 0, 0
33    %vreg123_2:vgpr_32 = COPY %4
34    %5:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0, 11, 0, 0
35    %vreg123_3:vgpr_32 = COPY %5
36    %16:sgpr_128 = REG_SEQUENCE killed %vreg123_0, %subreg.sub0, %vreg123_1, %subreg.sub1, %vreg123_2, %subreg.sub2, %vreg123_3, %subreg.sub3
37
38    BUFFER_STORE_DWORD_ADDR64 %vreg123_1, %27, killed %16, 0, 0, 0, 0, 0, 0, 0, implicit $exec
39    S_ENDPGM 0
40
41...
42