1 ; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
2 ; RUN: opt %loadPolly -polly-codegen -analyze < %s
4 ; void or(float *A, long n, long m) {
5 ; for (long i = 0; i < 100; i++) {
11 ; void and(float *A, long n, long m) {
12 ; for (long i = 0; i < 100; i++) {
18 ; CHECK-LABEL: Function: or
21 ; CHECK-NEXT: Stmt_if_then
22 ; CHECK-NEXT: Domain :=
23 ; CHECK-NEXT: [n, m] -> { Stmt_if_then[i0] : 0 <= i0 <= 99 and (i0 < m or i0 < n) };
24 ; CHECK-NEXT: Schedule :=
25 ; CHECK-NEXT: [n, m] -> { Stmt_if_then[i0] -> [i0] : i0 < m or i0 < n };
26 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
27 ; CHECK-NEXT: [n, m] -> { Stmt_if_then[i0] -> MemRef_A[i0] };
28 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
29 ; CHECK-NEXT: [n, m] -> { Stmt_if_then[i0] -> MemRef_A[i0] };
32 ; CHECK-LABEL: Function: and
35 ; CHECK-NEXT: Stmt_if_then
36 ; CHECK-NEXT: Domain :=
37 ; CHECK-NEXT: [n, m] -> { Stmt_if_then[i0] : 0 <= i0 <= 99 and i0 < m and i0 < n };
38 ; CHECK-NEXT: Schedule :=
39 ; CHECK-NEXT: [n, m] -> { Stmt_if_then[i0] -> [i0] };
40 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
41 ; CHECK-NEXT: [n, m] -> { Stmt_if_then[i0] -> MemRef_A[i0] };
42 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
43 ; CHECK-NEXT: [n, m] -> { Stmt_if_then[i0] -> MemRef_A[i0] };
46 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
48 ; Function Attrs: nounwind uwtable
49 define void @or(float* nocapture %A, i64 %n, i64 %m) #0 {
53 for.body: ; preds = %for.inc, %entry
54 %i.03 = phi i64 [ 0, %entry ], [ %inc, %for.inc ]
55 %cmp1 = icmp slt i64 %i.03, %n
56 %cmp2 = icmp slt i64 %i.03, %m
57 %or.cond = or i1 %cmp1, %cmp2
58 br i1 %or.cond, label %if.then, label %for.inc
60 if.then: ; preds = %for.body
61 %conv = sitofp i64 %i.03 to float
62 %arrayidx = getelementptr inbounds float, float* %A, i64 %i.03
63 %0 = load float, float* %arrayidx, align 4
64 %add = fadd float %conv, %0
65 store float %add, float* %arrayidx, align 4
68 for.inc: ; preds = %if.then, %for.body
69 %inc = add nuw nsw i64 %i.03, 1
70 %exitcond = icmp eq i64 %inc, 100
71 br i1 %exitcond, label %for.end, label %for.body
73 for.end: ; preds = %for.inc
77 ; Function Attrs: nounwind uwtable
78 define void @and(float* nocapture %A, i64 %n, i64 %m) #0 {
82 for.body: ; preds = %for.inc, %entry
83 %i.03 = phi i64 [ 0, %entry ], [ %inc, %for.inc ]
84 %cmp1 = icmp slt i64 %i.03, %n
85 %cmp2 = icmp slt i64 %i.03, %m
86 %or.cond = and i1 %cmp1, %cmp2
87 br i1 %or.cond, label %if.then, label %for.inc
89 if.then: ; preds = %for.body
90 %conv = sitofp i64 %i.03 to float
91 %arrayidx = getelementptr inbounds float, float* %A, i64 %i.03
92 %0 = load float, float* %arrayidx, align 4
93 %add = fadd float %conv, %0
94 store float %add, float* %arrayidx, align 4
97 for.inc: ; preds = %for.body, %if.then
98 %inc = add nuw nsw i64 %i.03, 1
99 %exitcond = icmp eq i64 %inc, 100
100 br i1 %exitcond, label %for.end, label %for.body
102 for.end: ; preds = %for.inc