1; RUN: opt %loadPolly  -polly-codegen -polly-invariant-load-hoisting=true -polly-ignore-aliasing -polly-process-unprofitable -S < %s | FileCheck %s
2;
3; CHECK-LABEL: polly.preload.begin:
4; CHECK:    %polly.access.B = getelementptr i32, i32* %B, i64 0
5; CHECK:    %polly.access.B.load = load i32, i32* %polly.access.B
6;
7; CHECK-LABEL: polly.stmt.bb2.split:
8; CHECK:    %scevgep = getelementptr i32, i32* %A, i64 %polly.indvar
9; CHECK:    store i32 %polly.access.B.load, i32* %scevgep, align 4
10;
11;    void f(int *restrict A, int *restrict B) {
12;      for (int i = 0; i < 1024; i++)
13;        auto tmp = *B;
14;        // Split BB
15;        A[i] = tmp;
16;    }
17;
18target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
19
20define void @f(i32* noalias %A, i32* noalias %B) {
21bb:
22  br label %bb1
23
24bb1:                                              ; preds = %bb4, %bb
25  %indvars.iv = phi i64 [ %indvars.iv.next, %bb4 ], [ 0, %bb ]
26  %exitcond = icmp ne i64 %indvars.iv, 1024
27  br i1 %exitcond, label %bb2, label %bb5
28
29bb2:                                              ; preds = %bb1
30  %tmp = load i32, i32* %B, align 4
31  br label %bb2.split
32
33bb2.split:
34  %tmp3 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
35  store i32 %tmp, i32* %tmp3, align 4
36  br label %bb4
37
38bb4:                                              ; preds = %bb2
39  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
40  br label %bb1
41
42bb5:                                              ; preds = %bb1
43  ret void
44}
45