diff options
| author | Matthias Braun <matze@braunis.de> | 2017-09-06 20:45:24 +0000 |
|---|---|---|
| committer | Matthias Braun <matze@braunis.de> | 2017-09-06 20:45:24 +0000 |
| commit | c9056b834dd7343204228a93ad54b7e8dda70dab (patch) | |
| tree | 4a1d309d43e68ddec515dac260af5b5a60b53ee6 /llvm/test/CodeGen/Hexagon | |
| parent | d147f522525ac091a5e3235b2c26c47733fe9ed9 (diff) | |
| download | bcm5719-llvm-c9056b834dd7343204228a93ad54b7e8dda70dab.tar.gz bcm5719-llvm-c9056b834dd7343204228a93ad54b7e8dda70dab.zip | |
Insert IMPLICIT_DEFS for undef uses in tail merging
Tail merging can convert an undef use into a normal one when creating a
common tail. Doing so can make the register live out from a block which
previously contained the undef use. To keep the liveness up-to-date,
insert IMPLICIT_DEFs in such blocks when necessary.
To enable this patch the computeLiveIns() function which used to
compute live-ins for a block and set them immediately is split into new
functions:
- computeLiveIns() just computes the live-ins in a LivePhysRegs set.
- addLiveIns() applies the live-ins to a block live-in list.
- computeAndAddLiveIns() is a convenience function combining the other
two functions and behaving like computeLiveIns() before this patch.
Based on a patch by Krzysztof Parzyszek <kparzysz@codeaurora.org>
Differential Revision: https://reviews.llvm.org/D37034
llvm-svn: 312668
Diffstat (limited to 'llvm/test/CodeGen/Hexagon')
| -rw-r--r-- | llvm/test/CodeGen/Hexagon/branchfolder-insert-impdef.mir | 87 | ||||
| -rw-r--r-- | llvm/test/CodeGen/Hexagon/livephysregs-lane-masks2.mir | 6 |
2 files changed, 90 insertions, 3 deletions
diff --git a/llvm/test/CodeGen/Hexagon/branchfolder-insert-impdef.mir b/llvm/test/CodeGen/Hexagon/branchfolder-insert-impdef.mir new file mode 100644 index 00000000000..bdb0614ede5 --- /dev/null +++ b/llvm/test/CodeGen/Hexagon/branchfolder-insert-impdef.mir @@ -0,0 +1,87 @@ +# RUN: llc -march=hexagon -run-pass branch-folder %s -o - -verify-machineinstrs | FileCheck %s + +# Branch folding will perform tail merging of bb.1 and bb.2, and bb.2 will +# become the common tail. The use of R0 in bb.2 is <undef> while the +# corresponding use in bb.1 is not. The common tail will have the <undef> +# flag removed, which will cause R0 to become a live-in to bb.2. The problem +# is that R0 is not live-out from all predecessors of bb.2, namely is not +# live-out from bb.0. To remedy that, the branch folder should add an +# IMPLICIT_DEF to that block. + +# CHECK-LABEL: name: func0 +# CHECK-LABEL: bb.0: +# CHECK: %r0 = IMPLICIT_DEF +# CHECK-LABEL: bb.1: +# CHECK-LABEL: bb.2: +# CHECK: liveins: %r0 +# CHECK: PS_storerhabs 0, %r0 +# CHECK: PS_jmpret + +--- +name: func0 +tracksRegLiveness: true + +body: | + bb.0: + liveins: %r31 + successors: %bb.1, %bb.2 + J2_jumpt undef %p0, %bb.2, implicit-def %pc + J2_jump %bb.1, implicit-def %pc + + bb.1: + liveins: %r31 + successors: %bb.3 + %r0 = L2_loadruh_io undef %r1, 0 + PS_storerhabs 0, killed %r0 + J2_jump %bb.3, implicit-def %pc + + bb.2: + liveins: %r31 + successors: %bb.3 + PS_storerhabs 0, undef %r0 + J2_jump %bb.3, implicit-def %pc + + bb.3: + liveins: %r31 + PS_jmpret killed %r31, implicit-def %pc +... +--- +# CHECK-LABEL: name: func1 +# CHECK-LABEL: bb.1: +# CHECK: %r0 = IMPLICIT_DEF +# CHECK-LABEL: bb.2: +# CHECK-LABEL: bb.3: +# CHECK: liveins: %r0 +# CHECK: PS_storerhabs 0, killed %r0 +# CHECK: PS_jmpret + +name: func1 +tracksRegLiveness: true + +body: | + bb.0: + liveins: %r31 + successors: %bb.1, %bb.2 + J2_jumpt undef %p0, %bb.2, implicit-def %pc + J2_jump %bb.1, implicit-def %pc + + bb.1: + liveins: %r31 + successors: %bb.3 + %r1 = A2_tfrsi 1 + PS_storerhabs 0, undef %r0 + %r0 = A2_tfrsi 1 + J2_jump %bb.3, implicit-def %pc + + bb.2: + liveins: %r31 + successors: %bb.3 + %r0 = L2_loadruh_io undef %r1, 0 + PS_storerhabs 0, killed %r0 + %r0 = A2_tfrsi 1 + J2_jump %bb.3, implicit-def %pc + + bb.3: + liveins: %r31 + PS_jmpret killed %r31, implicit undef %r0, implicit-def %pc +... diff --git a/llvm/test/CodeGen/Hexagon/livephysregs-lane-masks2.mir b/llvm/test/CodeGen/Hexagon/livephysregs-lane-masks2.mir index 58685701655..2b39a0cfc24 100644 --- a/llvm/test/CodeGen/Hexagon/livephysregs-lane-masks2.mir +++ b/llvm/test/CodeGen/Hexagon/livephysregs-lane-masks2.mir @@ -13,13 +13,13 @@ tracksRegLiveness: true body: | bb.0: - liveins: %p2, %r0 + liveins: %p0:0x1, %p2, %r0 successors: %bb.1, %bb.2 J2_jumpt killed %p2, %bb.1, implicit-def %pc J2_jump %bb.2, implicit-def %pc bb.1: - liveins: %r0, %r19 + liveins: %p0:0x1, %r0, %r19 successors: %bb.3 %r2 = A2_tfrsi 4 %r1 = COPY %r19 @@ -28,7 +28,7 @@ body: | J2_jump %bb.3, implicit-def %pc bb.2: - liveins: %r0, %r18 + liveins: %p0:0x1, %r0, %r18 successors: %bb.3 %r2 = A2_tfrsi 5 %r1 = L2_loadrh_io %r18, 0 |

