1 ; RUN: opt %loadNPMPolly -passes='sroa,instcombine,simplifycfg,reassociate,loop(loop-rotate),instcombine,indvars,polly-prepare,print<polly-function-scops>' \
2 ; RUN: -tailcallopt -disable-output < %s 2>&1 \
3 ; RUN: | FileCheck %s --check-prefix=NOLICM
5 ; RUN: opt %loadNPMPolly -passes='sroa,instcombine,simplifycfg,reassociate,loop(loop-rotate),instcombine,indvars,loop-mssa(licm),polly-prepare,print<polly-function-scops>' \
6 ; RUN: -tailcallopt -disable-output < %s 2>&1 \
7 ; RUN: | FileCheck %s --check-prefix=LICM
9 ; void foo(int n, float A[static const restrict n], float x) {
11 ; for (int i = 0; i < 5; i += 1) {
12 ; for (int j = 0; j < n; j += 1) {
23 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
25 define void @foo(i32 %n, ptr noalias nonnull %A, float %x) {
27 %n.addr = alloca i32, align 4
28 %A.addr = alloca ptr, align 8
29 %x.addr = alloca float, align 4
30 %i = alloca i32, align 4
31 %j = alloca i32, align 4
32 store i32 %n, ptr %n.addr, align 4
33 store ptr %A, ptr %A.addr, align 8
34 store float %x, ptr %x.addr, align 4
35 %tmp = load i32, ptr %n.addr, align 4
36 %tmp1 = zext i32 %tmp to i64
37 store i32 0, ptr %i, align 4
40 for.cond: ; preds = %for.inc.4, %entry
41 %tmp2 = load i32, ptr %i, align 4
42 %cmp = icmp slt i32 %tmp2, 5
43 br i1 %cmp, label %for.body, label %for.end.6
45 for.body: ; preds = %for.cond
46 store i32 0, ptr %j, align 4
49 for.cond.1: ; preds = %for.inc, %for.body
50 %tmp3 = load i32, ptr %j, align 4
51 %tmp4 = load i32, ptr %n.addr, align 4
52 %cmp2 = icmp slt i32 %tmp3, %tmp4
53 br i1 %cmp2, label %for.body.3, label %for.end
55 for.body.3: ; preds = %for.cond.1
56 store float 7.000000e+00, ptr %x.addr, align 4
59 for.inc: ; preds = %for.body.3
60 %tmp5 = load i32, ptr %j, align 4
61 %add = add nsw i32 %tmp5, 1
62 store i32 %add, ptr %j, align 4
65 for.end: ; preds = %for.cond.1
66 %tmp6 = load float, ptr %x.addr, align 4
67 %tmp7 = load ptr, ptr %A.addr, align 8
68 store float %tmp6, ptr %tmp7, align 4
71 for.inc.4: ; preds = %for.end
72 %tmp8 = load i32, ptr %i, align 4
73 %add5 = add nsw i32 %tmp8, 1
74 store i32 %add5, ptr %i, align 4
77 for.end.6: ; preds = %for.cond