1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=indvars -S | FileCheck %s
4 @Y = global [400 x i16] zeroinitializer, align 1
9 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
11 ; CHECK-NEXT: [[I:%.*]] = phi i16 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[FOR_BODY]] ]
12 ; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [400 x i16], ptr @Y, i16 0, i16 [[I]]
13 ; CHECK-NEXT: store i16 0, ptr [[ARRAYIDX]], align 1
14 ; CHECK-NEXT: [[INC]] = add nuw nsw i16 [[I]], 1
15 ; CHECK-NEXT: [[CMP:%.*]] = icmp ult i16 [[INC]], 400
16 ; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END:%.*]]
18 ; CHECK-NEXT: ret i16 400
23 for.body: ; preds = %entry, %for.body
24 %i = phi i16 [ 0, %entry ], [ %inc, %for.body ]
26 %arrayidx = getelementptr inbounds [400 x i16], ptr @Y, i16 0, i16 %i
27 store i16 0, ptr %arrayidx, align 1
28 %inc = add nuw nsw i16 %i, 1
29 %cmp = icmp ult i16 %inc, 400
30 br i1 %cmp, label %for.body, label %for.end
32 for.end: ; preds = %for.body
33 %inc.lcssa = phi i16 [ %inc, %for.body ]