65 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 do not hoist I[c] without execution context because it4; is executed in a statement with an invalid domain and it depends5; on a parameter that was specialized by the domain.6;7; CHECK: Invariant Accesses: {8; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]9; CHECK-NEXT: [c] -> { Stmt_if_then[i0] -> MemRef_I[-129] };10; CHECK-NEXT: Execution Context: [c] -> { : false }11; CHECK-NEXT: }12;13; TODO: FIXME: We should remove the statement as it has an empty domain.14; CHECK: Stmt_if_then15; CHECK-NEXT: Domain :=16; CHECK-NEXT: [c] -> { Stmt_if_then[i0] : false };17;18; int I[1024];19; void f(int *A, unsigned char c) {20; for (int i = 0; i < 10; i++)21; if ((signed char)(c + (unsigned char)1) == 127)22; A[i] += I[c];23; else24; A[i] = 0;25; }26;27target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"28 29@I = common global [1024 x i32] zeroinitializer, align 1630 31define void @f(ptr %A, i8 zeroext %c) {32entry:33 br label %for.cond34 35for.cond: ; preds = %for.inc, %entry36 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]37 %exitcond = icmp ne i64 %indvars.iv, 1038 br i1 %exitcond, label %for.body, label %for.end39 40for.body: ; preds = %for.cond41 %add = add i8 %c, 142 %cmp3 = icmp eq i8 %add, 12843 %arrayidx6 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv44 br i1 %cmp3, label %if.then, label %if.else45 46if.then: ; preds = %for.body47 %arrayidx = getelementptr inbounds [1024 x i32], ptr @I, i64 0, i8 %c48 %tmp = load i32, ptr %arrayidx, align 449 %tmp1 = load i32, ptr %arrayidx6, align 450 %add7 = add nsw i32 %tmp1, %tmp51 store i32 %add7, ptr %arrayidx6, align 452 br label %for.inc53 54if.else: ; preds = %if.then, %for.body55 store i32 0, ptr %arrayidx6, align 456 br label %for.inc57 58for.inc: ; preds = %if.else, if.then59 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 160 br label %for.cond61 62for.end: ; preds = %for.cond63 ret void64}65