1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
2 ; RUN: opt < %s -S -mtriple=riscv64 -passes=loop-unroll | FileCheck %s
4 ; Function Attrs: optsize
5 define void @foo(ptr %array, i32 %x) #0 {
6 ; CHECK-LABEL: define void @foo
7 ; CHECK-SAME: (ptr [[ARRAY:%.*]], i32 [[X:%.*]]) #[[ATTR0:[0-9]+]] {
9 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
11 ; CHECK-NEXT: store i32 [[X]], ptr [[ARRAY]], align 4
12 ; CHECK-NEXT: [[ARRAYIDX_1:%.*]] = getelementptr inbounds i32, ptr [[ARRAY]], i64 1
13 ; CHECK-NEXT: store i32 [[X]], ptr [[ARRAYIDX_1]], align 4
14 ; CHECK-NEXT: [[ARRAYIDX_2:%.*]] = getelementptr inbounds i32, ptr [[ARRAY]], i64 2
15 ; CHECK-NEXT: store i32 [[X]], ptr [[ARRAYIDX_2]], align 4
16 ; CHECK-NEXT: [[ARRAYIDX_3:%.*]] = getelementptr inbounds i32, ptr [[ARRAY]], i64 3
17 ; CHECK-NEXT: store i32 [[X]], ptr [[ARRAYIDX_3]], align 4
18 ; CHECK-NEXT: ret void
24 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
25 %arrayidx = getelementptr inbounds i32, ptr %array, i64 %indvars.iv
26 store i32 %x, ptr %arrayidx, align 4
27 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
28 %exitcond.not = icmp eq i64 %indvars.iv.next, 4
29 br i1 %exitcond.not, label %for.cond.cleanup, label %for.body
35 attributes #0 = { optsize }