1 ; RUN: opt %loadPolly -S < %s -polly-codegen-ppcg \
2 ; RUN: -polly-invariant-load-hoisting | FileCheck %s -check-prefix=CODEGEN
6 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n8:16:32-S64"
8 %S = type { i32, i32, [12 x %L] }
9 %L = type { i32, i32, double, i32, i32, i32, i32, i32 }
11 define void @test(%S* %cpi, i1 %b) {
12 ; CODEGEN-LABEL: @test(
13 ; CODEGEN: polly.preload.begin:
14 ; CODEGEN-NEXT: br i1 false
17 %nt = getelementptr inbounds %S, %S* %cpi, i32 0, i32 1
18 br i1 %b, label %if.then14, label %exit
21 %ns = getelementptr inbounds %S, %S* %cpi, i32 0, i32 0
22 %l0 = load i32, i32* %ns, align 8
23 %cmp12.i = icmp sgt i32 %l0, 0
24 br i1 %cmp12.i, label %for.body.lr.ph.i, label %exit
27 %l1 = load i32, i32* %nt, align 4
31 %phi = phi i32 [ 0, %for.body.lr.ph.i ], [ %inc, %for.body.i ]
32 %mul.i163 = mul nsw i32 %phi, %l1
33 %cv = getelementptr inbounds %S, %S* %cpi, i32 0, i32 2, i32 %mul.i163, i32 0
34 store i32 0, i32* %cv, align 8
35 %inc = add nuw nsw i32 %phi, 1
36 %l2 = load i32, i32* %ns, align 8
37 %cmp.i164 = icmp slt i32 %inc, %l2
38 br i1 %cmp.i164, label %for.body.i, label %exit