96 lines · plain
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py2# RUN: llc -mtriple=amdgcn -verify-machineinstrs -run-pass=register-coalescer -o - %s | FileCheck %s3 4# Test used to crash with message:5# JoinVals::computeAssignment(unsigned int, (anonymous namespace)::JoinVals &): Assertion `Assignments[ValNo] != -1 && "Bad recursion?"' failed.6 7# The issue was with processing two operands are parts of the same reg and are8# used in the same instruction (e.g. inline asm): first is "def early-clobber",9# while the other is just "def".10# Register coalescer ran in bad recursion if the early clobbered subreg is11# second in the following sequence of COPYs.12 13---14name: foo115tracksRegLiveness: true16body: |17 bb.0:18 liveins: $vgpr0_vgpr119 20 ; CHECK-LABEL: name: foo121 ; CHECK: liveins: $vgpr0_vgpr122 ; CHECK-NEXT: {{ $}}23 ; CHECK-NEXT: INLINEASM &"", 0 /* attdialect */, 1245194 /* regdef:VGPR_32 */, def undef %2.sub0, 1245195 /* regdef-ec:VGPR_32 */, def undef early-clobber %2.sub124 ; CHECK-NEXT: FLAT_STORE_DWORDX2 $vgpr0_vgpr1, %2, 0, 0, implicit $exec, implicit $flat_scr :: (store (s64))25 ; CHECK-NEXT: S_ENDPGM 026 INLINEASM &"", 0 /* attdialect */, 1245194 /* regdef:VGPR_32 */, def %0:vgpr_32, 1245195 /* regdef-ec:VGPR_32 */, def early-clobber %1:vgpr_3227 undef %2.sub0:vreg_64 = COPY killed %028 %2.sub1:vreg_64 = COPY killed %129 FLAT_STORE_DWORDX2 killed $vgpr0_vgpr1, killed %2, 0, 0, implicit $exec, implicit $flat_scr :: (store (s64))30 S_ENDPGM 031 32...33 34---35name: foo236tracksRegLiveness: true37body: |38 bb.0:39 liveins: $vgpr0_vgpr140 41 ; CHECK-LABEL: name: foo242 ; CHECK: liveins: $vgpr0_vgpr143 ; CHECK-NEXT: {{ $}}44 ; CHECK-NEXT: INLINEASM &"", 0 /* attdialect */, 1245195 /* regdef-ec:VGPR_32 */, def undef early-clobber %2.sub1, 1245194 /* regdef:VGPR_32 */, def undef %2.sub045 ; CHECK-NEXT: FLAT_STORE_DWORDX2 $vgpr0_vgpr1, %2, 0, 0, implicit $exec, implicit $flat_scr :: (store (s64))46 ; CHECK-NEXT: S_ENDPGM 047 INLINEASM &"", 0 /* attdialect */, 1245195 /* regdef-ec:VGPR_32 */, def early-clobber %1:vgpr_32, 1245194 /* regdef:VGPR_32 */, def %0:vgpr_3248 undef %2.sub0:vreg_64 = COPY killed %049 %2.sub1:vreg_64 = COPY killed %150 FLAT_STORE_DWORDX2 killed $vgpr0_vgpr1, killed %2, 0, 0, implicit $exec, implicit $flat_scr :: (store (s64))51 S_ENDPGM 052 53...54 55---56name: foo357tracksRegLiveness: true58body: |59 bb.0:60 liveins: $vgpr0_vgpr161 62 ; CHECK-LABEL: name: foo363 ; CHECK: liveins: $vgpr0_vgpr164 ; CHECK-NEXT: {{ $}}65 ; CHECK-NEXT: INLINEASM &"", 0 /* attdialect */, 1245194 /* regdef:VGPR_32 */, def undef %2.sub0, 1245195 /* regdef-ec:VGPR_32 */, def undef early-clobber %2.sub166 ; CHECK-NEXT: FLAT_STORE_DWORDX2 $vgpr0_vgpr1, %2, 0, 0, implicit $exec, implicit $flat_scr :: (store (s64))67 ; CHECK-NEXT: S_ENDPGM 068 INLINEASM &"", 0 /* attdialect */, 1245194 /* regdef:VGPR_32 */, def %1:vgpr_32, 1245195 /* regdef-ec:VGPR_32 */, def early-clobber %0:vgpr_3269 undef %2.sub0:vreg_64 = COPY killed %170 %2.sub1:vreg_64 = COPY killed %071 FLAT_STORE_DWORDX2 killed $vgpr0_vgpr1, killed %2, 0, 0, implicit $exec, implicit $flat_scr :: (store (s64))72 S_ENDPGM 073 74...75 76---77name: foo478tracksRegLiveness: true79body: |80 bb.0:81 liveins: $vgpr0_vgpr182 83 ; CHECK-LABEL: name: foo484 ; CHECK: liveins: $vgpr0_vgpr185 ; CHECK-NEXT: {{ $}}86 ; CHECK-NEXT: INLINEASM &"", 0 /* attdialect */, 1245195 /* regdef-ec:VGPR_32 */, def undef early-clobber %2.sub1, 1245194 /* regdef:VGPR_32 */, def undef %2.sub087 ; CHECK-NEXT: FLAT_STORE_DWORDX2 $vgpr0_vgpr1, %2, 0, 0, implicit $exec, implicit $flat_scr :: (store (s64))88 ; CHECK-NEXT: S_ENDPGM 089 INLINEASM &"", 0 /* attdialect */, 1245195 /* regdef-ec:VGPR_32 */, def early-clobber %0:vgpr_32, 1245194 /* regdef:VGPR_32 */, def %1:vgpr_3290 undef %2.sub0:vreg_64 = COPY killed %191 %2.sub1:vreg_64 = COPY killed %092 FLAT_STORE_DWORDX2 killed $vgpr0_vgpr1, killed %2, 0, 0, implicit $exec, implicit $flat_scr :: (store (s64))93 S_ENDPGM 094 95...96