diff options
author | Guozhi Wei <carrot@google.com> | 2019-12-04 16:01:20 -0800 |
---|---|---|
committer | Guozhi Wei <carrot@google.com> | 2019-12-06 09:53:53 -0800 |
commit | 72942459d070cbfe6f3524e89c3ac37440be7890 (patch) | |
tree | 6a45cb456c8fff75ba7c89eb4156254ef6d485d8 /llvm/test/CodeGen/RISCV/remat.ll | |
parent | 164e0fc5c7f782b174db5c87b37725ea0e174853 (diff) | |
download | bcm5719-llvm-72942459d070cbfe6f3524e89c3ac37440be7890.tar.gz bcm5719-llvm-72942459d070cbfe6f3524e89c3ac37440be7890.zip |
[MBP] Avoid tail duplication if it can't bring benefit
Current tail duplication integrated in bb layout is designed to increase the fallthrough from a BB's predecessor to its successor, but we have observed cases that duplication doesn't increase fallthrough, or it brings too much size overhead.
To overcome these two issues in function canTailDuplicateUnplacedPreds I add two checks:
make sure there is at least one duplication in current work set.
the number of duplication should not exceed the number of successors.
The modification in hasBetterLayoutPredecessor fixes a bug that potential predecessor must be at the bottom of a chain.
Differential Revision: https://reviews.llvm.org/D64376
Diffstat (limited to 'llvm/test/CodeGen/RISCV/remat.ll')
-rw-r--r-- | llvm/test/CodeGen/RISCV/remat.ll | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/llvm/test/CodeGen/RISCV/remat.ll b/llvm/test/CodeGen/RISCV/remat.ll index d8267e7a7ee..e440515d632 100644 --- a/llvm/test/CodeGen/RISCV/remat.ll +++ b/llvm/test/CodeGen/RISCV/remat.ll @@ -52,20 +52,19 @@ define i32 @test() nounwind { ; RV32I-NEXT: lui s9, %hi(h) ; RV32I-NEXT: lui s10, %hi(c) ; RV32I-NEXT: lui s11, %hi(b) -; RV32I-NEXT: lw a1, %lo(l)(s2) -; RV32I-NEXT: bnez a1, .LBB0_4 -; RV32I-NEXT: j .LBB0_5 +; RV32I-NEXT: j .LBB0_3 ; RV32I-NEXT: .LBB0_2: # %for.inc -; RV32I-NEXT: # in Loop: Header=BB0_5 Depth=1 +; RV32I-NEXT: # in Loop: Header=BB0_3 Depth=1 ; RV32I-NEXT: lw a0, %lo(a)(s6) ; RV32I-NEXT: addi a0, a0, -1 ; RV32I-NEXT: sw a0, %lo(a)(s6) ; RV32I-NEXT: beqz a0, .LBB0_11 -; RV32I-NEXT: # %bb.3: # %for.body -; RV32I-NEXT: # in Loop: Header=BB0_5 Depth=1 +; RV32I-NEXT: .LBB0_3: # %for.body +; RV32I-NEXT: # =>This Inner Loop Header: Depth=1 ; RV32I-NEXT: lw a1, %lo(l)(s2) ; RV32I-NEXT: beqz a1, .LBB0_5 -; RV32I-NEXT: .LBB0_4: # %if.then +; RV32I-NEXT: # %bb.4: # %if.then +; RV32I-NEXT: # in Loop: Header=BB0_3 Depth=1 ; RV32I-NEXT: lw a1, %lo(b)(s11) ; RV32I-NEXT: lw a2, %lo(c)(s10) ; RV32I-NEXT: lw a3, %lo(d)(s1) @@ -73,11 +72,11 @@ define i32 @test() nounwind { ; RV32I-NEXT: addi a5, zero, 32 ; RV32I-NEXT: call foo ; RV32I-NEXT: .LBB0_5: # %if.end -; RV32I-NEXT: # =>This Inner Loop Header: Depth=1 +; RV32I-NEXT: # in Loop: Header=BB0_3 Depth=1 ; RV32I-NEXT: lw a0, %lo(k)(s3) ; RV32I-NEXT: beqz a0, .LBB0_7 ; RV32I-NEXT: # %bb.6: # %if.then3 -; RV32I-NEXT: # in Loop: Header=BB0_5 Depth=1 +; RV32I-NEXT: # in Loop: Header=BB0_3 Depth=1 ; RV32I-NEXT: lw a0, %lo(b)(s11) ; RV32I-NEXT: lw a1, %lo(c)(s10) ; RV32I-NEXT: lw a2, %lo(d)(s1) @@ -86,11 +85,11 @@ define i32 @test() nounwind { ; RV32I-NEXT: addi a5, zero, 64 ; RV32I-NEXT: call foo ; RV32I-NEXT: .LBB0_7: # %if.end5 -; RV32I-NEXT: # in Loop: Header=BB0_5 Depth=1 +; RV32I-NEXT: # in Loop: Header=BB0_3 Depth=1 ; RV32I-NEXT: lw a0, %lo(j)(s4) ; RV32I-NEXT: beqz a0, .LBB0_9 ; RV32I-NEXT: # %bb.8: # %if.then7 -; RV32I-NEXT: # in Loop: Header=BB0_5 Depth=1 +; RV32I-NEXT: # in Loop: Header=BB0_3 Depth=1 ; RV32I-NEXT: lw a0, %lo(c)(s10) ; RV32I-NEXT: lw a1, %lo(d)(s1) ; RV32I-NEXT: lw a2, %lo(e)(s0) @@ -99,11 +98,11 @@ define i32 @test() nounwind { ; RV32I-NEXT: addi a5, zero, 32 ; RV32I-NEXT: call foo ; RV32I-NEXT: .LBB0_9: # %if.end9 -; RV32I-NEXT: # in Loop: Header=BB0_5 Depth=1 +; RV32I-NEXT: # in Loop: Header=BB0_3 Depth=1 ; RV32I-NEXT: lw a0, %lo(i)(s5) ; RV32I-NEXT: beqz a0, .LBB0_2 ; RV32I-NEXT: # %bb.10: # %if.then11 -; RV32I-NEXT: # in Loop: Header=BB0_5 Depth=1 +; RV32I-NEXT: # in Loop: Header=BB0_3 Depth=1 ; RV32I-NEXT: lw a0, %lo(d)(s1) ; RV32I-NEXT: lw a1, %lo(e)(s0) ; RV32I-NEXT: lw a2, %lo(f)(s7) |