1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/test/CodeGen/Hexagon/swp-chain-refs.ll
James Molloy 25cc728d30 [ModuloSchedule] Peel out prologs and epilogs, generate actual code
Summary:
This extends the PeelingModuloScheduleExpander to generate prolog and epilog code,
and correctly stitch uses through the prolog, kernel, epilog DAG.

The key concept in this patch is to ensure that all transforms are *local*; only a
function of a block and its immediate predecessor and successor. By defining the problem in this way
we can inductively rewrite the entire DAG using only local knowledge that is easy to
reason about.

For example, we assume that all prologs and epilogs are near-perfect clones of the
steady-state kernel. This means that if a block has an instruction that is predicated out,
we can redirect all users of that instruction to that equivalent instruction in our
immediate predecessor. As all blocks are clones, every instruction must have an equivalent in
every other block.

Similarly we can make the assumption by construction that if a value defined in a block is used
outside that block, the only possible user is its immediate successors. We maintain this
even for values that are used outside the loop by creating a limited form of LCSSA.

This code isn't small, but it isn't complex.

Enabled a bunch of testing from Hexagon. There are a couple of tests not enabled yet;
I'm about 80% sure there isn't buggy codegen but the tests are checking for patterns
that we don't produce. Those still need a bit more investigation. In the meantime we
(Google) are happy with the code produced by this on our downstream SMS implementation,
and believe it generates correct code.

Subscribers: mgorny, hiraditya, jsji, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D68205

llvm-svn: 373462
2019-10-02 12:46:44 +00:00

67 lines
2.1 KiB
LLVM

; RUN: llc -march=hexagon -enable-pipeliner=true -stats -o /dev/null < %s \
; RUN: 2>&1 -pipeliner-experimental-cg=true | FileCheck %s --check-prefix=STATS
; REQUIRES: asserts
; Test that we do not schedule chained references too far apart,
; which enables the loop to be pipelined. In this test, the loop should
; not be pipelined when the chained references are constrained correctly.
; STATS-NOT: 1 pipeliner - Number of loops software pipelined
; Function Attrs: nounwind
define void @f0() #0 {
b0:
br label %b2
b1: ; preds = %b6
br label %b7
b2: ; preds = %b6, %b0
br label %b3
b3: ; preds = %b5, %b2
br i1 undef, label %b4, label %b5
b4: ; preds = %b3
br label %b5
b5: ; preds = %b4, %b3
br i1 undef, label %b3, label %b6
b6: ; preds = %b5
br i1 undef, label %b1, label %b2
b7: ; preds = %b7, %b1
%v0 = phi i32 [ 0, %b1 ], [ %v4, %b7 ]
%v1 = load i16, i16* undef, align 8, !tbaa !0
%v2 = icmp sgt i16 %v1, undef
%v3 = select i1 %v2, i16 4, i16 undef
store i16 %v3, i16* undef, align 2, !tbaa !0
store i16 -32768, i16* undef, align 2, !tbaa !0
%v4 = add i32 %v0, 1
%v5 = icmp eq i32 %v4, 5
br i1 %v5, label %b8, label %b7
b8: ; preds = %b7
br i1 undef, label %b9, label %b10
b9: ; preds = %b8
br label %b10
b10: ; preds = %b9, %b8
br i1 undef, label %b11, label %b12
b11: ; preds = %b10
unreachable
b12: ; preds = %b10
ret void
}
attributes #0 = { nounwind "target-cpu"="hexagonv55" }
!0 = !{!1, !1, i64 0}
!1 = !{!"short", !2}
!2 = !{!"omnipotent char", !3}
!3 = !{!"Simple C/C++ TBAA"}