1 ; RUN: opt %loadNPMPolly -polly-invariant-load-hoisting=true '-passes=print<polly-function-scops>' -disable-output < %s 2>&1 | FileCheck %s
3 ; void f(int *A, int *B, int *C) {
4 ; for (int i = 0; i < 1000; i++)
9 ; Check that only the access to *B is hoisted but not the one to *C.
11 ; CHECK: Invariant Accesses: {
12 ; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
13 ; CHECK: { Stmt_for_body__TO__if_end[i0] -> MemRef_B[0] };
14 ; CHECK: Execution Context: { : }
18 ; CHECK: Stmt_for_body__TO__if_end
19 ; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
20 ; CHECK: { Stmt_for_body__TO__if_end[i0] -> MemRef_C[0] };
24 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
26 define void @f(ptr %A, ptr %B, ptr %C) {
30 for.cond: ; preds = %for.inc, %entry
31 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
32 %exitcond = icmp ne i64 %indvars.iv, 1000
33 br i1 %exitcond, label %for.body, label %for.end
35 for.body: ; preds = %for.cond
36 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
37 %tmp = load i32, ptr %arrayidx, align 4
38 %tmp1 = load i32, ptr %B, align 4
39 %cmp1 = icmp eq i32 %tmp, %tmp1
40 br i1 %cmp1, label %if.then, label %if.end
42 if.then: ; preds = %for.body
43 %tmp2 = load i32, ptr %C, align 4
44 %arrayidx3 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
45 store i32 %tmp2, ptr %arrayidx3, align 4
48 if.end: ; preds = %if.then, %for.body
51 for.inc: ; preds = %if.end
52 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
55 for.end: ; preds = %for.cond