2017-05-05 20:20:07 +08:00
|
|
|
# RUN: llc -march=hexagon -run-pass branch-folder -run-pass if-converter -verify-machineinstrs %s -o - | FileCheck %s
|
|
|
|
|
|
|
|
# The hoisting of common instructions from successors could cause registers
|
|
|
|
# to no longer be live-in in the successor blocks. The liveness was updated
|
|
|
|
# to include potential new live-in registres, but not to remove registers
|
|
|
|
# that were no longer live-in.
|
|
|
|
# This could cause if-converter to generate incorrect code.
|
|
|
|
#
|
2017-12-07 18:40:31 +08:00
|
|
|
# In this testcase, the "r1 = A2_sxth killed r0" was hoisted, and since r0
|
2017-05-05 20:20:07 +08:00
|
|
|
# was killed, it was no longer live-in in either successor. The if-converter
|
|
|
|
# then created code, where the first predicated instruction has incorrect
|
|
|
|
# implicit use of r0:
|
|
|
|
#
|
2017-12-05 01:18:51 +08:00
|
|
|
# %bb.0:
|
2018-02-09 09:14:44 +08:00
|
|
|
# liveins: %r0
|
|
|
|
# %r1 = A2_sxth killed %r0 ; hoisted, kills r0
|
2017-12-07 18:40:31 +08:00
|
|
|
# A2_nop implicit-def %P0
|
2018-02-09 09:14:44 +08:00
|
|
|
# %r0 = C2_cmoveit %P0, 2, implicit %r0 ; predicated A2_tfrsi
|
|
|
|
# %r0 = C2_cmoveif killed %P0, 1, implicit %r0 ; predicated A2_tfrsi
|
|
|
|
# %r0 = A2_add killed %r0, killed %r1
|
|
|
|
# J2_jumpr %r31, implicit dead %PC
|
2017-05-05 20:20:07 +08:00
|
|
|
#
|
|
|
|
|
2018-02-01 06:04:26 +08:00
|
|
|
# CHECK: $r1 = A2_sxth killed $r0
|
|
|
|
# CHECK: $r0 = C2_cmoveit $p0, 2
|
|
|
|
# CHECK-NOT: implicit-def $r0
|
|
|
|
# CHECK: $r0 = C2_cmoveif killed $p0, 1, implicit killed $r0
|
2017-05-05 20:20:07 +08:00
|
|
|
|
|
|
|
---
|
|
|
|
name: fred
|
|
|
|
tracksRegLiveness: true
|
|
|
|
|
|
|
|
body: |
|
|
|
|
bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
liveins: $r0
|
2017-05-05 20:20:07 +08:00
|
|
|
successors: %bb.1, %bb.2
|
|
|
|
|
2018-02-01 06:04:26 +08:00
|
|
|
A2_nop implicit-def $p0
|
|
|
|
J2_jumpt killed $p0, %bb.2, implicit-def dead $pc
|
2017-05-05 20:20:07 +08:00
|
|
|
|
|
|
|
bb.1:
|
|
|
|
successors: %bb.3
|
2018-02-01 06:04:26 +08:00
|
|
|
liveins: $r0
|
|
|
|
$r1 = A2_sxth killed $r0
|
|
|
|
$r0 = A2_tfrsi 1
|
|
|
|
J2_jump %bb.3, implicit-def $pc
|
2017-05-05 20:20:07 +08:00
|
|
|
|
|
|
|
bb.2:
|
|
|
|
successors: %bb.3
|
2018-02-01 06:04:26 +08:00
|
|
|
liveins: $r0
|
|
|
|
$r1 = A2_sxth killed $r0
|
|
|
|
$r0 = A2_tfrsi 2
|
2017-05-05 20:20:07 +08:00
|
|
|
|
|
|
|
bb.3:
|
2018-02-01 06:04:26 +08:00
|
|
|
liveins: $r0, $r1
|
|
|
|
$r0 = A2_add killed $r0, killed $r1
|
|
|
|
J2_jumpr $r31, implicit-def dead $pc
|
2017-05-05 20:20:07 +08:00
|
|
|
...
|
|
|
|
|