1# RUN: llc -mtriple=x86_64-unknown-linux-gnu -run-pass=register-coalescer -o - %s 2 3# An implicit-def will be added to SUBREG_TO_REG during coalescing 4--- 5name: rematerialize_subreg_to_reg_added_impdef_0 6tracksRegLiveness: true 7body: | 8 bb.0: 9 successors: %bb.1(0x2aaaaaab), %bb.2(0x55555555) 10 liveins: $edi 11 12 %0:gr32 = MOV32r0 implicit-def dead $eflags 13 %1:gr8 = COPY %0.sub_8bit 14 %2:gr64 = SUBREG_TO_REG 0, killed %0, %subreg.sub_32bit 15 JCC_1 %bb.2, 5, implicit killed undef $eflags 16 17 bb.1: 18 %4:gr8 = COPY %1 19 %5:gr8 = COPY killed undef %1 20 JMP_1 %bb.5 21 22 bb.2: 23 %6:gr64 = IMPLICIT_DEF 24 %2:gr64 = COPY killed %6 25 %5:gr8 = MOV8ri 1 26 27 bb.5: 28 successors: %bb.6(0x30000000), %bb.7(0x50000000) 29 30 TEST8rr killed undef %5, %5, implicit-def $eflags 31 JCC_1 %bb.7, 5, implicit killed undef $eflags 32 33 bb.6: 34 $al = COPY killed %1 35 RET 0, killed undef $al 36 37 bb.7: 38 MOV64mr undef $noreg, 1, undef $noreg, 0, undef $noreg, killed %2 :: (store (s64)) 39 RET 0, killed undef $al 40 41... 42 43 44# Reduced version of previous with the SUBREG_TO_REG already folded 45# away. 46# 47# The mov32r0 defines a subregister and has an implicit-def of the 48# super register. After coalescing, the full register implicit def of 49# %2 becomes a different subregister def. 50 51--- 52name: rematerialize_subreg_to_reg_coalesces_to_subreg_impdef 53tracksRegLiveness: true 54body: | 55 bb.0: 56 successors: %bb.1(0x2aaaaaab), %bb.2(0x55555555) 57 liveins: $edi 58 59 undef %2.sub_32bit:gr64_with_sub_8bit = MOV32r0 implicit-def dead $eflags, implicit-def %2 60 %1:gr8 = COPY %2.sub_8bit 61 JCC_1 %bb.2, 5, implicit killed undef $eflags 62 63 bb.1: 64 successors: %bb.3(0x80000000) 65 66 dead %3:gr8 = COPY %1 67 %4:gr8 = COPY undef %1 68 JMP_1 %bb.3 69 70 bb.2: 71 successors: %bb.3(0x80000000) 72 73 %5:gr64 = IMPLICIT_DEF 74 %2:gr64_with_sub_8bit = COPY %5 75 %4:gr8 = MOV8ri 1 76 77 bb.3: 78 successors: %bb.4(0x30000000), %bb.5(0x50000000) 79 80 TEST8rr undef %4, %4, implicit-def $eflags 81 JCC_1 %bb.5, 5, implicit killed undef $eflags 82 83 bb.4: 84 $al = COPY %1 85 RET 0, killed undef $al 86 87 bb.5: 88 MOV64mr undef $noreg, 1, undef $noreg, 0, undef $noreg, %2 :: (store (s64)) 89 RET 0, killed undef $al 90 91... 92