1 # RUN: llc -mtriple=hexagon -run-pass pipeliner -debug-only=pipeliner %s -o /dev/null 2>&1 -pipeliner-experimental-cg=true | FileCheck %s
4 # Test that the loop carried dependence check correctly identifies a recurrence
5 # when the loop variable decreases and the array index offset is negative.
20 %lsr.iv = phi ptr [ %0, %b3 ], [ undef, %b0 ]
21 %v0 = phi i32 [ %v8, %b3 ], [ 7, %b0 ]
22 %v1 = phi i32 [ %v6, %b3 ], [ undef, %b0 ]
23 %v2 = phi i32 [ %v1, %b3 ], [ undef, %b0 ]
24 %lsr.iv1 = bitcast ptr %lsr.iv to ptr
25 %cgep = getelementptr i32, ptr %lsr.iv1, i32 -2
26 %v6 = load i32, ptr %cgep, align 4
27 %v7 = tail call i32 @llvm.hexagon.A2.subsat(i32 %v2, i32 %v6)
28 store i32 %v7, ptr %lsr.iv1, align 4
30 %cgep3 = getelementptr [9 x i32], ptr %lsr.iv, i32 0, i32 -1
31 %0 = bitcast ptr %cgep3 to ptr
32 %v9 = icmp sgt i32 %v8, 1
33 br i1 %v9, label %b3, label %b4
39 declare i32 @llvm.hexagon.A2.subsat(i32, i32) #0
40 declare void @llvm.stackprotector(ptr, ptr) #1
45 tracksRegLiveness: true
51 %10:intregs = IMPLICIT_DEF
52 %11:intregs = IMPLICIT_DEF
53 J2_loop0i %bb.1, 6, implicit-def $lc0, implicit-def $sa0, implicit-def $usr
55 bb.1 (machine-block-address-taken):
56 successors: %bb.1, %bb.2
58 %0:intregs = PHI %11, %bb.0, %6, %bb.1
59 %2:intregs = PHI %10, %bb.0, %4, %bb.1
60 %3:intregs = PHI %10, %bb.0, %2, %bb.1
61 %4:intregs = L2_loadri_io %0, -8 :: (load (s32) from %ir.cgep)
62 %12:intregs = A2_subsat %3, %4, implicit-def dead $usr_ovf
63 S2_storeri_io %0, 0, %12 :: (store (s32) into %ir.lsr.iv1)
64 %6:intregs = A2_addi %0, -4
65 ENDLOOP0 %bb.1, implicit-def $pc, implicit-def $lc0, implicit $sa0, implicit $lc0
66 J2_jump %bb.2, implicit-def dead $pc