1 ; RUN: opt %loadPolly -basicaa -sroa -instcombine -simplifycfg -tailcallopt \
2 ; RUN: -simplifycfg -reassociate -loop-rotate -instcombine -indvars \
3 ; RUN: -polly-prepare -polly-scops -analyze < %s \
5 ; RUN: | FileCheck %s --check-prefix=NOLICM
7 ; RUN: opt %loadPolly -basicaa -sroa -instcombine -simplifycfg -tailcallopt \
8 ; RUN: -simplifycfg -reassociate -loop-rotate -instcombine -indvars -licm \
9 ; RUN: -polly-prepare -polly-scops -analyze < %s \
11 ; RUN: | FileCheck %s --check-prefix=LICM
13 ; void foo(int n, float A[static const restrict n], float x) {
15 ; for (int i = 0; i < 5; i += 1) {
16 ; for (int j = 0; j < n; j += 1) {
27 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
29 define void @foo(i32 %n, float* noalias nonnull %A, float %x) {
31 %n.addr = alloca i32, align 4
32 %A.addr = alloca float*, align 8
33 %x.addr = alloca float, align 4
34 %i = alloca i32, align 4
35 %j = alloca i32, align 4
36 store i32 %n, i32* %n.addr, align 4
37 store float* %A, float** %A.addr, align 8
38 store float %x, float* %x.addr, align 4
39 %tmp = load i32, i32* %n.addr, align 4
40 %tmp1 = zext i32 %tmp to i64
41 store i32 0, i32* %i, align 4
44 for.cond: ; preds = %for.inc.4, %entry
45 %tmp2 = load i32, i32* %i, align 4
46 %cmp = icmp slt i32 %tmp2, 5
47 br i1 %cmp, label %for.body, label %for.end.6
49 for.body: ; preds = %for.cond
50 store i32 0, i32* %j, align 4
53 for.cond.1: ; preds = %for.inc, %for.body
54 %tmp3 = load i32, i32* %j, align 4
55 %tmp4 = load i32, i32* %n.addr, align 4
56 %cmp2 = icmp slt i32 %tmp3, %tmp4
57 br i1 %cmp2, label %for.body.3, label %for.end
59 for.body.3: ; preds = %for.cond.1
60 store float 7.000000e+00, float* %x.addr, align 4
63 for.inc: ; preds = %for.body.3
64 %tmp5 = load i32, i32* %j, align 4
65 %add = add nsw i32 %tmp5, 1
66 store i32 %add, i32* %j, align 4
69 for.end: ; preds = %for.cond.1
70 %tmp6 = load float, float* %x.addr, align 4
71 %tmp7 = load float*, float** %A.addr, align 8
72 %arrayidx = getelementptr inbounds float, float* %tmp7, i64 0
73 store float %tmp6, float* %arrayidx, align 4
76 for.inc.4: ; preds = %for.end
77 %tmp8 = load i32, i32* %i, align 4
78 %add5 = add nsw i32 %tmp8, 1
79 store i32 %add5, i32* %i, align 4
82 for.end.6: ; preds = %for.cond