72 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;3; Check that we do not try to preload *I and assume p != 42.4;5; CHECK: Invariant Accesses: {6; CHECK-NEXT: }7;8; CHECK: Invalid Context:9; CHECK-NEXT: [N, p] -> { : false }10;11; CHECK: Stmt_if_then__TO__if_end12; CHECK-NEXT: Domain :=13; CHECK-NEXT: [N, p] -> { Stmt_if_then__TO__if_end[i0] : p = 42 and 0 <= i0 < N };14;15; void f(int *A, int *I, int N, int p, int q) {16; for (int i = 0; i < N; i++) {17; if (p == 42) {18; *I = 0;19; if (*I == q)20; A[i] *= 2;21; }22; A[i]++;23; }24; }25;26target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"27 28define void @f(ptr %A, ptr %I, i32 %N, i32 %p, i32 %q) {29entry:30 %tmp = sext i32 %N to i6431 br label %for.cond32 33for.cond: ; preds = %for.inc, %entry34 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]35 %cmp = icmp slt i64 %indvars.iv, %tmp36 br i1 %cmp, label %for.body, label %for.end37 38for.body: ; preds = %for.cond39 %cmp1 = icmp eq i32 %p, 4240 br i1 %cmp1, label %if.then, label %if.end441 42if.then: ; preds = %for.body43 store i32 0, ptr %I, align 444 %tmp1 = load i32, ptr %I, align 445 %cmp2 = icmp eq i32 %tmp1, %q46 br i1 %cmp2, label %if.then3, label %if.end47 48if.then3: ; preds = %if.then49 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv50 %tmp2 = load i32, ptr %arrayidx, align 451 %mul = shl nsw i32 %tmp2, 152 store i32 %mul, ptr %arrayidx, align 453 br label %if.end54 55if.end: ; preds = %if.then3, %if.then56 br label %if.end457 58if.end4: ; preds = %if.end, %for.body59 %arrayidx6 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv60 %tmp3 = load i32, ptr %arrayidx6, align 461 %inc = add nsw i32 %tmp3, 162 store i32 %inc, ptr %arrayidx6, align 463 br label %for.inc64 65for.inc: ; preds = %if.end466 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 167 br label %for.cond68 69for.end: ; preds = %for.cond70 ret void71}72