1# RUN: llc -march=hexagon -run-pass branch-folder -run-pass if-converter -verify-machineinstrs %s -o - | FileCheck %s 2 3# The hoisting of common instructions from successors could cause registers 4# to no longer be live-in in the successor blocks. The liveness was updated 5# to include potential new live-in registres, but not to remove registers 6# that were no longer live-in. 7# This could cause if-converter to generate incorrect code. 8# 9# In this testcase, the "r1 = A2_sxth killed r0" was hoisted, and since r0 10# was killed, it was no longer live-in in either successor. The if-converter 11# then created code, where the first predicated instruction has incorrect 12# implicit use of r0: 13# 14# %bb.0: 15# liveins: %r0 16# %r1 = A2_sxth killed %r0 ; hoisted, kills r0 17# A2_nop implicit-def %P0 18# %r0 = C2_cmoveit %P0, 2, implicit %r0 ; predicated A2_tfrsi 19# %r0 = C2_cmoveif killed %P0, 1, implicit %r0 ; predicated A2_tfrsi 20# %r0 = A2_add killed %r0, killed %r1 21# J2_jumpr %r31, implicit dead %PC 22# 23 24# CHECK: $r1 = A2_sxth killed $r0 25# CHECK: $r0 = C2_cmoveit $p0, 2 26# CHECK-NOT: implicit-def $r0 27# CHECK: $r0 = C2_cmoveif killed $p0, 1, implicit killed $r0 28 29--- 30name: fred 31tracksRegLiveness: true 32 33body: | 34 bb.0: 35 liveins: $r0 36 successors: %bb.1, %bb.2 37 38 A2_nop implicit-def $p0 39 J2_jumpt killed $p0, %bb.2, implicit-def dead $pc 40 41 bb.1: 42 successors: %bb.3 43 liveins: $r0 44 $r1 = A2_sxth killed $r0 45 $r0 = A2_tfrsi 1 46 J2_jump %bb.3, implicit-def $pc 47 48 bb.2: 49 successors: %bb.3 50 liveins: $r0 51 $r1 = A2_sxth killed $r0 52 $r0 = A2_tfrsi 2 53 54 bb.3: 55 liveins: $r0, $r1 56 $r0 = A2_add killed $r0, killed $r1 57 J2_jumpr $r31, implicit-def dead $pc 58... 59 60