1; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s 2; RUN: opt %loadPolly -polly-codegen -analyze < %s 3; 4; void or(float *A, long n, long m) { 5; for (long i = 0; i < 100; i++) { 6; if (i < n || i < m) 7; A[i] += i; 8; } 9; } 10; 11; void and(float *A, long n, long m) { 12; for (long i = 0; i < 100; i++) { 13; if (i < n && i < m) 14; A[i] += i; 15; } 16; } 17 18; CHECK-LABEL: Function: or 19; 20; CHECK: Statements { 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] }; 30; CHECK-NEXT: } 31; 32; CHECK-LABEL: Function: and 33; 34; CHECK: Statements { 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] }; 44; CHECK-NEXT: } 45 46target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 47 48; Function Attrs: nounwind uwtable 49define void @or(float* nocapture %A, i64 %n, i64 %m) #0 { 50entry: 51 br label %for.body 52 53for.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 59 60if.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 66 br label %for.inc 67 68for.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 72 73for.end: ; preds = %for.inc 74 ret void 75} 76 77; Function Attrs: nounwind uwtable 78define void @and(float* nocapture %A, i64 %n, i64 %m) #0 { 79entry: 80 br label %for.body 81 82for.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 88 89if.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 95 br label %for.inc 96 97for.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 101 102for.end: ; preds = %for.inc 103 ret void 104} 105