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