mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
25cc728d30
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
71 lines
2.0 KiB
YAML
71 lines
2.0 KiB
YAML
# RUN: llc -mtriple=hexagon -run-pass pipeliner -debug-only=pipeliner %s -o /dev/null 2>&1 -pipeliner-experimental-cg=true | FileCheck %s
|
|
# REQUIRES: asserts
|
|
|
|
# Test that the loop carried dependence check correctly identifies a recurrence
|
|
# when the loop variable decreases and the array index offset is negative.
|
|
|
|
# CHECK: Rec NodeSet
|
|
# CHECK: Rec NodeSet
|
|
# CHECK: SU(3)
|
|
# CHECK: SU(4)
|
|
# CHECK: SU(5)
|
|
|
|
--- |
|
|
|
|
define void @test() {
|
|
b0:
|
|
br label %b3
|
|
|
|
b3:
|
|
%lsr.iv = phi [9 x i32]* [ %0, %b3 ], [ undef, %b0 ]
|
|
%v0 = phi i32 [ %v8, %b3 ], [ 7, %b0 ]
|
|
%v1 = phi i32 [ %v6, %b3 ], [ undef, %b0 ]
|
|
%v2 = phi i32 [ %v1, %b3 ], [ undef, %b0 ]
|
|
%lsr.iv1 = bitcast [9 x i32]* %lsr.iv to i32*
|
|
%cgep = getelementptr i32, i32* %lsr.iv1, i32 -2
|
|
%v6 = load i32, i32* %cgep, align 4
|
|
%v7 = tail call i32 @llvm.hexagon.A2.subsat(i32 %v2, i32 %v6)
|
|
store i32 %v7, i32* %lsr.iv1, align 4
|
|
%v8 = add i32 %v0, -1
|
|
%cgep3 = getelementptr [9 x i32], [9 x i32]* %lsr.iv, i32 0, i32 -1
|
|
%0 = bitcast i32* %cgep3 to [9 x i32]*
|
|
%v9 = icmp sgt i32 %v8, 1
|
|
br i1 %v9, label %b3, label %b4
|
|
|
|
b4:
|
|
unreachable
|
|
}
|
|
|
|
declare i32 @llvm.hexagon.A2.subsat(i32, i32) #0
|
|
declare void @llvm.stackprotector(i8*, i8**) #1
|
|
|
|
...
|
|
---
|
|
name: test
|
|
tracksRegLiveness: true
|
|
|
|
body: |
|
|
bb.0:
|
|
successors: %bb.1
|
|
|
|
%10:intregs = IMPLICIT_DEF
|
|
%11:intregs = IMPLICIT_DEF
|
|
J2_loop0i %bb.1, 6, implicit-def $lc0, implicit-def $sa0, implicit-def $usr
|
|
|
|
bb.1 (address-taken):
|
|
successors: %bb.1, %bb.2
|
|
|
|
%0:intregs = PHI %11, %bb.0, %6, %bb.1
|
|
%2:intregs = PHI %10, %bb.0, %4, %bb.1
|
|
%3:intregs = PHI %10, %bb.0, %2, %bb.1
|
|
%4:intregs = L2_loadri_io %0, -8 :: (load 4 from %ir.cgep)
|
|
%12:intregs = A2_subsat %3, %4, implicit-def dead $usr_ovf
|
|
S2_storeri_io %0, 0, %12 :: (store 4 into %ir.lsr.iv1)
|
|
%6:intregs = A2_addi %0, -4
|
|
ENDLOOP0 %bb.1, implicit-def $pc, implicit-def $lc0, implicit $sa0, implicit $lc0
|
|
J2_jump %bb.2, implicit-def dead $pc
|
|
|
|
bb.2:
|
|
|
|
...
|