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 4 5; CHECK-LABEL: not_rotated 6; CHECK-LATCH-NOT: call void @llvm.set.loop.iterations 7; CHECK-LATCH-NOT: call i1 @llvm.loop.decrement 8 9; CHECK-ALLOW: bb: 10; CHECK-ALLOW: [[COUNT:%[^ ]+]] = add i32 %arg, 1 11; CHECK-ALLOW: br label %bb3 12; CHECK-ALLOW: bb5: 13; CHECK-ALLOW: call void @llvm.set.loop.iterations.i32(i32 [[COUNT]]) 14; CHECK-ALLOW: br label %bb7 15 16; CHECK-ALLOW: [[CMP:%[^ ]+]] = call i1 @llvm.loop.decrement.i32(i32 1) 17; CHECK-ALLOW: br i1 [[CMP]], label %bb10, label %bb16 18define void @not_rotated(i32 %arg, i16* nocapture %arg1, i16 signext %arg2) { 19bb: 20 br label %bb3 21 22bb3: ; 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 26 27bb5: ; preds = %bb3 28 %tmp6 = mul i32 %tmp, %arg 29 br label %bb7 30 31bb7: ; 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 35 36bb10: ; preds = %bb7 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 43 br label %bb7 44 45bb16: ; preds = %bb7 46 %tmp17 = add i32 %tmp, 1 47 br label %bb3 48 49bb18: ; preds = %bb3 50 ret void 51} 52