1 ; RUN: opt -loop-unroll -S -mtriple aarch64 -mcpu=cortex-a57 %s | FileCheck %s -check-prefix=UNROLL
2 ; RUN: opt -loop-unroll -unroll-max-upperbound=0 -S -mtriple aarch64 -mcpu=cortex-a57 %s | FileCheck %s -check-prefix=NOUNROLL
4 ; This IR comes from this C code:
6 ; for (int i = 0; i < 4; i++) {
13 ; This test is meant to check that this loop is unrolled into four iterations.
16 ; UNROLL: load i32, i32*
17 ; UNROLL: load i32, i32*
18 ; UNROLL: load i32, i32*
19 ; UNROLL: load i32, i32*
20 ; UNROLL-NOT: load i32, i32*
21 ; NOUNROLL-LABEL: @test
22 ; NOUNROLL: load i32, i32*
23 ; NOUNROLL-NOT: load i32, i32*
25 define void @test(i32* %dst, i32* %src) {
29 for.body: ; preds = %entry, %for.body
30 %i = phi i32 [ 0, %entry ], [ %inc, %for.body ]
31 %0 = sext i32 %i to i64
32 %1 = getelementptr inbounds i32, i32* %src, i64 %0
33 %2 = load i32, i32* %1
34 %inc = add nsw i32 %i, 1
35 %cmp1 = icmp slt i32 %inc, 4
36 %cmp3 = icmp eq i32 %2, 1
37 %or.cond = and i1 %cmp3, %cmp1
38 br i1 %or.cond, label %for.body, label %exit
40 exit: ; preds = %for.body
41 store i32 %i, i32* %dst