1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/test/CodeGen/Thumb2/cbnz.ll
Guozhi Wei 2be00d9e54 [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
2019-12-06 09:53:53 -08:00

55 lines
883 B
LLVM

; RUN: llc -mtriple thumbv7-unknown-linux -o - %s | FileCheck %s
declare void @x()
declare void @y()
define void @f(i32 %x, i32 %y) {
; CHECK-LABEL: f:
; CHECK: cbz
%p = icmp eq i32 %x, 0
br i1 %p, label %t, label %f
t:
call void @x()
call void @x()
call void @x()
call void @x()
call void @x()
call void @x()
call void @x()
call void @x()
call void @x()
call void @x()
call void @x()
call void @x()
call void @x()
call void @x()
call void @x()
call void @x()
; CHECK: bne
%q = icmp eq i32 %y, 0
br i1 %q, label %t2, label %f
t2:
call void @x()
call void @x()
call void @x()
call void @x()
call void @x()
call void @x()
call void @x()
call void @x()
call void @x()
call void @x()
call void @x()
call void @x()
call void @x()
call void @x()
call void @x()
br label %f
f:
call void @y()
ret void
}