1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00
Kang Zhang 29c0ba58cf [PowerPC] Remove the redundant implicit operands in ppc-early-ret pass
Summary:
In the `ppc-early-ret` pass, we have use `BuildMI` and `copyImplicitOps` when the branch instructions can do the early return. But the two functions will add implicit operands twice, this is not correct.

This patch is to remove the redundant implicit operands in `ppc-early-ret pass`.

Reviewed By: jsji

Differential Revision: https://reviews.llvm.org/D76042
2020-07-19 07:01:45 +00:00

147 lines
4.1 KiB
YAML

# RUN: llc -mtriple powerpc64le-unknown-linux-gnu -run-pass=ppc-early-ret -o \
# RUN: - %s -verify-machineinstrs | FileCheck %s
---
name: testBLR
body: |
bb.0.entry:
successors: %bb.1(0x40000000), %bb.2(0x40000000)
liveins: $r3, $r4
renamable $cr0 = CMPWI renamable $r3, 0
BC killed renamable $cr0gt, %bb.1
B %bb.2
bb.1.entry:
successors: %bb.2(0x80000000)
liveins: $r4
renamable $r3 = ADDI killed renamable $r4, 0
bb.2.entry:
liveins: $r3, $r4, $cr0eq, $cr0lt, $cr0un, $cr0, $cr0gt, $r3, $r3, $r4, $r3, $cr0gt
BLR implicit $lr, implicit $rm, implicit killed $r3
; CHECK-LABEL: name: testBLR
; CHECK: bb.0.entry:
; CHECK: renamable $cr0 = CMPWI renamable $r3, 0
; CHECK: BC killed renamable $cr0gt, %bb.1
; CHECK: BLR implicit $lr, implicit $rm, implicit killed $r3
; CHECK: bb.1.entry:
; CHECK: renamable $r3 = ADDI killed renamable $r4, 0
; CHECK: BLR implicit $lr, implicit $rm, implicit killed $r3
...
---
name: testBCLRn
body: |
bb.0.entry:
successors: %bb.3(0x20000000), %bb.1(0x60000000)
liveins: $f1, $f2, $f3, $f4, $v2, $v3
renamable $cr0 = FCMPUS killed renamable $f3, killed renamable $f4
BCn killed renamable $cr0eq, %bb.3
bb.1.entry:
successors: %bb.2(0x80000000)
liveins: $f1, $f2, $v2, $v3
renamable $cr0 = FCMPUS killed renamable $f1, killed renamable $f2
BCLR killed renamable $cr0eq, implicit $lr, implicit $rm, implicit killed $v2
bb.2:
successors: %bb.3(0x80000000)
liveins: $v3
$v2 = VOR killed $v3, $v3
bb.3:
liveins: $v2
BLR implicit $lr, implicit $rm, implicit killed $v2
; CHECK-LABEL: name: testBCLRn
; CHECK: bb.0.entry:
; CHECK: renamable $cr0 = FCMPUS killed renamable $f3, killed renamable $f4
; CHECK: BCLRn killed renamable $cr0eq, implicit $lr, implicit $rm, implicit killed $v2
; CHECK: bb.1.entry:
; CHECK: renamable $cr0 = FCMPUS killed renamable $f1, killed renamable $f2
; CHECK: BCLR killed renamable $cr0eq, implicit $lr, implicit $rm, implicit killed $v2
; CHECK: bb.2:
; CHECK: $v2 = VOR killed $v3, $v3
; CHECK: BLR implicit $lr, implicit $rm, implicit killed $v2
...
---
name: testBCLR
body: |
bb.0.entry:
successors: %bb.3(0x20000000), %bb.1(0x60000000)
liveins: $f1, $f2, $f3, $f4, $v2, $v3
renamable $cr0 = FCMPUS killed renamable $f3, killed renamable $f4
BC killed renamable $cr0eq, %bb.3
bb.1.entry:
successors: %bb.2(0x80000000)
liveins: $f1, $f2, $v2, $v3
renamable $cr0 = FCMPUS killed renamable $f1, killed renamable $f2
BCLRn killed renamable $cr0eq, implicit $lr, implicit $rm, implicit killed $v2
bb.2:
successors: %bb.3(0x80000000)
liveins: $v3
$v2 = VOR killed $v3, $v3
bb.3:
liveins: $v2
BLR implicit $lr, implicit $rm, implicit killed $v2
; CHECK-LABEL: name: testBCLR
; CHECK: bb.0.entry:
; CHECK: renamable $cr0 = FCMPUS killed renamable $f3, killed renamable $f4
; CHECK: BCLR killed renamable $cr0eq, implicit $lr, implicit $rm, implicit killed $v2
; CHECK: bb.1.entry:
; CHECK: renamable $cr0 = FCMPUS killed renamable $f1, killed renamable $f2
; CHECK: BCLRn killed renamable $cr0eq, implicit $lr, implicit $rm, implicit killed $v2
; CHECK: bb.2:
; CHECK: $v2 = VOR killed $v3, $v3
; CHECK: BLR implicit $lr, implicit $rm, implicit killed $v2
...
---
name: testBCCLR
body: |
bb.0.entry:
successors: %bb.2(0x40000000), %bb.1(0x40000000)
renamable $r4 = LI 0
renamable $cr0 = CMPLWI killed renamable $r4, 0
BCC 68, renamable $cr0, %bb.2
bb.1:
successors: %bb.2(0x40000000)
liveins: $cr0
BCC 68, killed renamable $cr0, %bb.2
bb.2:
BLR implicit $lr, implicit $rm
; CHECK-LABEL: name: testBCCLR
; CHECK: bb.0.entry:
; CHECK: renamable $r4 = LI 0
; CHECK: renamable $cr0 = CMPLWI killed renamable $r4, 0
; CHECK: BCCLR 68, renamable $cr0, implicit $lr, implicit $rm
; CHECK: bb.1:
; CHECK: BCCLR 68, killed renamable $cr0, implicit $lr, implicit $rm
; CHECK: BLR implicit $lr, implicit $rm
...