55 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; Verify we hoist I[0] without execution context even though it4; is executed in a statement with an invalid domain.5;6; CHECK: Invariant Accesses: {7; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]8; CHECK-NEXT: [c] -> { Stmt_if_then[i0] -> MemRef_I[0] };9; CHECK-NEXT: Execution Context: [c] -> { : }10; CHECK-NEXT: }11;12; int I[1];13; void f(int *A, unsigned char c) {14; for (int i = 0; i < 10; i++)15; if ((signed char)(c + (unsigned char)1) > 0)16; A[i] += I[0];17; }18;19target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"20 21@I = common global [1 x i32] zeroinitializer, align 422 23define void @f(ptr %A, i8 zeroext %c) {24entry:25 br label %for.cond26 27for.cond: ; preds = %for.inc, %entry28 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]29 %exitcond = icmp ne i64 %indvars.iv, 1030 br i1 %exitcond, label %for.body, label %for.end31 32for.body: ; preds = %for.cond33 %add = add i8 %c, 134 %cmp3 = icmp sgt i8 %add, 035 br i1 %cmp3, label %if.then, label %if.end36 37if.then: ; preds = %for.body38 %tmp = load i32, ptr @I, align 439 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv40 %tmp1 = load i32, ptr %arrayidx, align 441 %add5 = add nsw i32 %tmp1, %tmp42 store i32 %add5, ptr %arrayidx, align 443 br label %if.end44 45if.end: ; preds = %if.then, %for.body46 br label %for.inc47 48for.inc: ; preds = %if.end49 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 150 br label %for.cond51 52for.end: ; preds = %for.cond53 ret void54}55