1 # RUN: llc -march=hexagon -run-pass branch-folder -run-pass if-converter -verify-machineinstrs %s -o - | FileCheck %s
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.
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
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
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
31 tracksRegLiveness: true
36 successors: %bb.1, %bb.2
38 A2_nop implicit-def $p0
39 J2_jumpt killed $p0, %bb.2, implicit-def dead $pc
44 $r1 = A2_sxth killed $r0
46 J2_jump %bb.3, implicit-def $pc
51 $r1 = A2_sxth killed $r0
56 $r0 = A2_add killed $r0, killed $r1
57 J2_jumpr $r31, implicit-def dead $pc