1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 13:11:39 +01:00
llvm-mirror/test/CodeGen/Hexagon/verify-liveness-at-def.mir
Bjorn Pettersson 463634ad4b [MachineVerifier] Relax checkLivenessAtDef regarding dead subreg defs
Summary:
Consider an instruction that has multiple defs of the same
vreg, but defining different subregs:
  %7.sub1:rc, dead %7.sub2:rc = inst

Calling checkLivenessAtDef for the live interval associated
with %7 incorrectly reported "live range continues after a
dead def". The live range for %7 has a dead def at the slot
index for "inst" even if the live range continues (given that
there are later uses of %7.sub1).

This patch adjusts MachineVerifier::checkLivenessAtDef
to allow dead subregister definitions, unless we are checking
a subrange (when tracking subregister liveness).

A limitation is that we do not detect the situation when the
live range continues past an instruction that defines the
full virtual register by multiple dead subreg defines.

I also removed some dead code related to physical register
in checkLivenessAtDef. Wwe only call that method for virtual
registers, so I added an assertion instead.

Reviewers: kparzysz

Reviewed By: kparzysz

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D52237

llvm-svn: 342618
2018-09-20 06:59:18 +00:00

75 lines
2.5 KiB
YAML

# Using a trick to run simple-register-coalescing twice, that way
# liveintervals should be preserved while running the machine verifier.
#
# RUN: not llc -o - %s -march=hexagon -hexagon-subreg-liveness=false -run-pass simple-register-coalescing -verify-machineinstrs -run-pass simple-register-coalescing 2>&1 | FileCheck -check-prefix=CHECK-NOSUB %s
# RUN: not llc -o - %s -march=hexagon -hexagon-subreg-liveness=true -run-pass simple-register-coalescing -verify-machineinstrs -run-pass simple-register-coalescing 2>&1 | FileCheck -check-prefix=CHECK-SUB %s
---
name: test_pass
tracksRegLiveness: true
body: |
bb.0:
A2_nop implicit-def %0:doubleregs
A2_nop implicit-def dead %0.isub_lo, implicit-def %0.isub_hi, implicit %0
A2_nop implicit %0.isub_hi
...
---
name: test_fail
tracksRegLiveness: true
body: |
bb.0:
A2_nop implicit-def %0:doubleregs
A2_nop implicit-def dead %0.isub_lo, implicit-def %0.isub_hi, implicit %0
A2_nop implicit %0.isub_lo
A2_nop implicit-def %1:doubleregs
A2_nop implicit-def dead %1.isub_lo, implicit-def dead %1.isub_hi, implicit %1
A2_nop implicit %1
A2_nop implicit-def dead %2:doubleregs
A2_nop implicit %2
...
###############################################################################
# We are expecting four "Bad machine code" when subregister liveness is used.
#
# CHECK-SUB-NOT: Bad machine code
#
# CHECK-SUB: Bad machine code: Live range continues after dead def flag
# CHECK_SUB-NEXT: function: test_fail
# CHECK-SUB: v. register: %0
# CHECK-SUB: lanemask: 00000002
#
# CHECK-SUB-NOT: Bad machine code
#
# CHECK-SUB: Bad machine code: Live range continues after dead def flag
# CHECK-SUB-NEXT: function: test_fail
# CHECK-SUB: v. register: %1
# CHECK-SUB: lanemask: 00000002
#
# CHECK-SUB-NOT: Bad machine code
#
# CHECK-SUB: Bad machine code: Live range continues after dead def flag
# CHECK-SUB-NEXT: function: test_fail
# CHECK-SUB: v. register: %1
# CHECK-SUB: lanemask: 00000001
#
# CHECK-SUB: Bad machine code: Live range continues after dead def flag
# CHECK-SUB-NEXT: function: test_fail
# CHECK: v. register: %2
#
# CHECK-SUB-NOT: Bad machine code
###############################################################################
# Without subregister liveness we only detect one of the failing scenarios.
#
# CHECK-NOSUB-NOT: Bad machine code
#
# CHECK-NOSUB: Bad machine code: Live range continues after dead def flag
# CHECK-NOSUB-NEXT: function: test_fail
# CHECK: v. register: %2
#
# CHECK-NOSUB-NOT: Bad machine code