1 ; RUN: opt %loadPolly -polly-print-scops -polly-invariant-load-hoisting=true -disable-output < %s | FileCheck %s
3 ; Verify we do not hoist I[c] without execution context because it
4 ; is executed in a statement with an invalid domain and it depends
5 ; on a parameter that was specialized by the domain.
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 }
13 ; TODO: FIXME: We should remove the statement as it has an empty domain.
15 ; CHECK-NEXT: Domain :=
16 ; CHECK-NEXT: [c] -> { Stmt_if_then[i0] : false };
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)
27 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
29 @I = common global [1024 x i32] zeroinitializer, align 16
31 define void @f(ptr %A, i8 zeroext %c) {
35 for.cond: ; preds = %for.inc, %entry
36 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
37 %exitcond = icmp ne i64 %indvars.iv, 10
38 br i1 %exitcond, label %for.body, label %for.end
40 for.body: ; preds = %for.cond
42 %cmp3 = icmp eq i8 %add, 128
43 %arrayidx6 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
44 br i1 %cmp3, label %if.then, label %if.else
46 if.then: ; preds = %for.body
47 %arrayidx = getelementptr inbounds [1024 x i32], ptr @I, i64 0, i8 %c
48 %tmp = load i32, ptr %arrayidx, align 4
49 %tmp1 = load i32, ptr %arrayidx6, align 4
50 %add7 = add nsw i32 %tmp1, %tmp
51 store i32 %add7, ptr %arrayidx6, align 4
54 if.else: ; preds = %if.then, %for.body
55 store i32 0, ptr %arrayidx6, align 4
58 for.inc: ; preds = %if.else, if.then
59 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
62 for.end: ; preds = %for.cond