1; RUN: opt %loadNPMPolly -aa-pipeline=basic-aa '-passes=print<polly-dependences>' -disable-output < %s | FileCheck %s 2; 3; Verify we do not have dependences between the if and the else clause 4; 5; CHECK: RAW dependences: 6; CHECK-NEXT: { } 7; CHECK-NEXT: WAR dependences: 8; CHECK-NEXT: { } 9; CHECK-NEXT: WAW dependences: 10; CHECK-NEXT: { } 11; CHECK-NEXT: Reduction dependences: 12; CHECK-NEXT: { Stmt_if_else[i0] -> Stmt_if_else[1 + i0] : 512 <= i0 <= 1022; Stmt_if_then[i0] -> Stmt_if_then[1 + i0] : 0 <= i0 <= 510 } 13; 14; void f(int *restrict sum, int *restrict prod) { 15; for (int i = 0; i < 1024; i++) 16; if (i < 512) 17; *sum += i; 18; else 19; *prod *= i; 20; } 21; 22target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64" 23 24define void @f(ptr noalias %sum, ptr noalias %prod) { 25entry: 26 br label %for.cond 27 28for.cond: ; preds = %for.inc, %entry 29 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ] 30 %exitcond = icmp ne i32 %i.0, 1024 31 br i1 %exitcond, label %for.body, label %for.end 32 33for.body: ; preds = %for.cond 34 %cmp1 = icmp slt i32 %i.0, 512 35 br i1 %cmp1, label %if.then, label %if.else 36 37if.then: ; preds = %for.body 38 %tmp = load i32, ptr %sum, align 4 39 %add = add nsw i32 %tmp, %i.0 40 store i32 %add, ptr %sum, align 4 41 br label %if.end 42 43if.else: ; preds = %for.body 44 %tmp1 = load i32, ptr %prod, align 4 45 %mul = mul nsw i32 %tmp1, %i.0 46 store i32 %mul, ptr %prod, align 4 47 br label %if.end 48 49if.end: ; preds = %if.else, %if.then 50 br label %for.inc 51 52for.inc: ; preds = %if.end 53 %inc = add nsw i32 %i.0, 1 54 br label %for.cond 55 56for.end: ; preds = %for.cond 57 ret void 58} 59