1 ; RUN: opt %loadPolly -polly-use-llvm-names -polly-scops \
2 ; RUN: -polly-invariant-load-hoisting -polly-codegen-ppcg \
3 ; RUN: -polly-acc-dump-code -disable-output \
4 ; RUN: < %s | FileCheck %s -check-prefix=CODE
6 ; RUN: opt %loadPolly -polly-use-llvm-names -polly-scops \
7 ; RUN: -polly-invariant-load-hoisting -polly-codegen-ppcg \
8 ; RUN: -polly-acc-dump-kernel-ir -disable-output \
9 ; RUN: < %s | FileCheck %s -check-prefix=KERNELIR
13 ; void f(const int *end, int *arr, const int *control, const int *readarr) {
14 ; for (int i = 0; i < *end; i++) {
23 ; This test case tests the ability to infer that `t` is local to each loop
24 ; iteration, and can therefore be privatized.
27 ; CODE-NEXT: for (int c0 = 0; c0 <= (tmp - 32 * b0 - 1) / 1048576; c0 += 1)
28 ; CODE-NEXT: if (tmp >= 32 * b0 + t0 + 1048576 * c0 + 1) {
29 ; CODE-NEXT: Stmt_for_body_last(32 * b0 + t0 + 1048576 * c0);
30 ; CODE-NEXT: if (tmp1 >= 4)
31 ; CODE-NEXT: Stmt_if_then(32 * b0 + t0 + 1048576 * c0);
32 ; CODE-NEXT: Stmt_if_end(32 * b0 + t0 + 1048576 * c0);
35 ; KERNELIR: %private_array = alloca i32
37 target datalayout = "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128"
38 target triple = "i386-apple-macosx10.12.0"
40 define void @f(i32* %end, i32* %arr, i32* %control, i32* %readarr) {
44 entry.split: ; preds = %entry
45 %tmp3 = load i32, i32* %end, align 4
46 %cmp4 = icmp sgt i32 %tmp3, 0
47 br i1 %cmp4, label %for.body.lr.ph, label %for.end
49 for.body.lr.ph: ; preds = %entry.split
52 for.body: ; preds = %for.body.lr.ph, %if.end
53 %i.05 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %if.end ]
54 %tmp1 = load i32, i32* %control, align 4
55 %cmp1 = icmp sgt i32 %tmp1, 3
56 br i1 %cmp1, label %if.then, label %if.end
58 if.then: ; preds = %for.body
59 %arrayidx = getelementptr inbounds i32, i32* %readarr, i32 %i.05
60 %tmp2 = load i32, i32* %arrayidx, align 4
63 if.end: ; preds = %if.then, %for.body
64 %t.0 = phi i32 [ %tmp2, %if.then ], [ 0, %for.body ]
65 %arrayidx2 = getelementptr inbounds i32, i32* %arr, i32 %i.05
66 store i32 %t.0, i32* %arrayidx2, align 4
67 %inc = add nuw nsw i32 %i.05, 1
68 %tmp = load i32, i32* %end, align 4
69 %cmp = icmp slt i32 %inc, %tmp
70 br i1 %cmp, label %for.body, label %for.cond.for.end_crit_edge
72 for.cond.for.end_crit_edge: ; preds = %if.end
75 for.end: ; preds = %for.cond.for.end_crit_edge, %entry.split