62 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<scops>' -polly-print-scops -polly-invariant-load-hoisting=true -disable-output < %s 2>&1 | FileCheck %s2; RUN: opt %loadNPMPolly '-passes=polly<no-default-opts>' -polly-invariant-load-hoisting=true -S < %s 2>&1 | FileCheck %s --check-prefix=IR3;4; CHECK: Invariant Accesses: {5; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]6; CHECK-NEXT: [N, tmp1] -> { Stmt_for_body[i0] -> MemRef_I[0] };7; CHECK-NEXT: Execution Context: [N, tmp1] -> { : N > 0 and (tmp1 >= 43 or tmp1 <= 41) }8; CHECK-NEXT: }9; CHECK: Invalid Context:10; CHECK-NEXT: [N, tmp1] -> { : tmp1 = 42 and N > 0 }11;12; IR: polly.preload.begin:13; IR-NEXT: br i1 false, label %polly.start, label %for.cond14;15; void f(int *A, int *I, int N) {16; for (int i = 0; i < N; i++) {17; if (*I == 42)18; *I = 0;19; else20; A[i]++;21; }22; }23;24target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"25 26define void @f(ptr %A, ptr %I, i32 %N) {27entry:28 %tmp = sext i32 %N to i6429 br label %for.cond30 31for.cond: ; preds = %for.inc, %entry32 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]33 %cmp = icmp slt i64 %indvars.iv, %tmp34 br i1 %cmp, label %for.body, label %for.end35 36for.body: ; preds = %for.cond37 %tmp1 = load i32, ptr %I, align 438 %cmp1 = icmp eq i32 %tmp1, 4239 br i1 %cmp1, label %if.then, label %if.else40 41if.then: ; preds = %for.body42 store i32 0, ptr %I, align 443 br label %if.end44 45if.else: ; preds = %for.body46 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv47 %tmp2 = load i32, ptr %arrayidx, align 448 %inc = add nsw i32 %tmp2, 149 store i32 %inc, ptr %arrayidx, align 450 br label %if.end51 52if.end: ; preds = %if.else, %if.then53 br label %for.inc54 55for.inc: ; preds = %if.end56 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 157 br label %for.cond58 59for.end: ; preds = %for.cond60 ret void61}62