1 ; RUN: opt -force-hardware-loops=true -hardware-loop-decrement=1 -hardware-loop-counter-bitwidth=32 -hardware-loops -S %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-ALLOW
2 ; RUN: opt -force-hardware-loops=true -hardware-loop-decrement=1 -hardware-loop-counter-bitwidth=32 -hardware-loops -force-hardware-loop-guard=true -S %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-ALLOW
3 ; RUN: opt -force-hardware-loops=true -hardware-loop-decrement=1 -hardware-loop-counter-bitwidth=32 -force-hardware-loop-phi=true -hardware-loops -S %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-LATCH
5 ; CHECK-LABEL: not_rotated
6 ; CHECK-LATCH-NOT: call void @llvm.set.loop.iterations
7 ; CHECK-LATCH-NOT: call i1 @llvm.loop.decrement
10 ; CHECK-ALLOW: [[COUNT:%[^ ]+]] = add i32 %arg, 1
11 ; CHECK-ALLOW: br label %bb3
13 ; CHECK-ALLOW: call void @llvm.set.loop.iterations.i32(i32 [[COUNT]])
14 ; CHECK-ALLOW: br label %bb7
16 ; CHECK-ALLOW: [[CMP:%[^ ]+]] = call i1 @llvm.loop.decrement.i32(i32 1)
17 ; CHECK-ALLOW: br i1 [[CMP]], label %bb10, label %bb16
18 define void @not_rotated(i32 %arg, i16* nocapture %arg1, i16 signext %arg2) {
22 bb3: ; preds = %bb16, %bb
23 %tmp = phi i32 [ 0, %bb ], [ %tmp17, %bb16 ]
24 %tmp4 = icmp eq i32 %tmp, %arg
25 br i1 %tmp4, label %bb18, label %bb5
28 %tmp6 = mul i32 %tmp, %arg
31 bb7: ; preds = %bb10, %bb5
32 %tmp8 = phi i32 [ %tmp15, %bb10 ], [ 0, %bb5 ]
33 %tmp9 = icmp eq i32 %tmp8, %arg
34 br i1 %tmp9, label %bb16, label %bb10
37 %tmp11 = add i32 %tmp8, %tmp6
38 %tmp12 = getelementptr inbounds i16, i16* %arg1, i32 %tmp11
39 %tmp13 = load i16, i16* %tmp12, align 2
40 %tmp14 = add i16 %tmp13, %arg2
41 store i16 %tmp14, i16* %tmp12, align 2
42 %tmp15 = add i32 %tmp8, 1
46 %tmp17 = add i32 %tmp, 1