mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-05 18:27:59 +00:00
abb4b9d9ee
The tail duplication pass uses an assumed layout when making duplication decisions. This is fine, but passes up duplication opportunities that may arise when blocks are outlined. Because we want the updated CFG to affect subsequent placement decisions, this change must occur during placement. In order to achieve this goal, TailDuplicationPass is split into a utility class, TailDuplicator, and the pass itself. The pass delegates nearly everything to the TailDuplicator object, except for looping over the blocks in a function. This allows the same code to be used for tail duplication in both places. This change, in concert with outlining optional branches, allows triangle shaped code to perform much better, esepecially when the taken/untaken branches are correlated, as it creates a second spine when the tests are small enough. Issue from previous rollback fixed, and a new test was added for that case as well. Issue was worklist/scheduling/taildup issue in layout. Issue from 2nd rollback fixed, with 2 additional tests. Issue was tail merging/loop info/tail-duplication causing issue with loops that share a header block. Issue with early tail-duplication of blocks that branch to a fallthrough predecessor fixed with test case: tail-dup-branch-to-fallthrough.ll Differential revision: https://reviews.llvm.org/D18226 llvm-svn: 283934
28 lines
605 B
LLVM
28 lines
605 B
LLVM
; RUN: llc < %s -mtriple=arm64-eabi | FileCheck %s
|
|
; rdar://12771555
|
|
|
|
define void @foo(i16* %ptr, i32 %a) nounwind {
|
|
entry:
|
|
; CHECK-LABEL: foo:
|
|
%tmp1 = icmp ult i32 %a, 100
|
|
br i1 %tmp1, label %bb1, label %bb2
|
|
bb1:
|
|
; CHECK: %bb1
|
|
; CHECK: ldrh [[REG:w[0-9]+]]
|
|
%tmp2 = load i16, i16* %ptr, align 2
|
|
br label %bb2
|
|
bb2:
|
|
; CHECK-NOT: and {{w[0-9]+}}, [[REG]], #0xffff
|
|
; CHECK: cmp [[REG]], #23
|
|
%tmp3 = phi i16 [ 0, %entry ], [ %tmp2, %bb1 ]
|
|
%cmp = icmp ult i16 %tmp3, 24
|
|
br i1 %cmp, label %bb3, label %exit
|
|
bb3:
|
|
call void @bar() nounwind
|
|
br label %exit
|
|
exit:
|
|
ret void
|
|
}
|
|
|
|
declare void @bar ()
|