1 ; RUN: opt %loadNPMPolly -passes=polly-codegen -polly-codegen-generate-expressions=false \
2 ; RUN: -S < %s | FileCheck %s -check-prefix=SCEV
3 ; RUN: opt %loadNPMPolly -passes=polly-codegen -polly-codegen-generate-expressions=true \
4 ; RUN: -S < %s | FileCheck %s -check-prefix=ASTEXPR
6 ; void foo(float A[]) {
7 ; for (long i = 0; i < 100; i++)
11 ; SCEV: polly.stmt.bb2: ; preds = %polly.loop_header
12 ; SCEV-NEXT: %0 = trunc i64 %polly.indvar to i2
13 ; SCEV-NEXT: %1 = zext i2 %0 to i64
14 ; SCEV-NEXT: %2 = shl nuw nsw i64 %1, 2
15 ; SCEV-NEXT: %scevgep = getelementptr i8, ptr %A, i64 %2
16 ; SCEV-NEXT: %tmp4_p_scalar_ = load float, ptr %scevgep, align 4, !alias.scope !2, !noalias !5
17 ; SCEV-NEXT: %p_tmp5 = fadd float %tmp4_p_scalar_, 1.000000e+01
18 ; SCEV-NEXT: store float %p_tmp5, ptr %scevgep, align 4, !alias.scope !2, !noalias !5
19 ; SCEV-NEXT: %polly.indvar_next = add nsw i64 %polly.indvar, 1
20 ; SCEV-NEXT: %polly.loop_cond = icmp sle i64 %polly.indvar_next, 99
21 ; SCEV-NEXT: br i1 %polly.loop_cond, label %polly.loop_header, label %polly.loop_exit
23 ; ASTEXPR: polly.stmt.bb2: ; preds = %polly.loop_header
24 ; ASTEXPR-NEXT: %pexp.pdiv_r = urem i64 %polly.indvar, 4
25 ; ASTEXPR-NEXT: %polly.access.A = getelementptr float, ptr %A, i64 %pexp.pdiv_r
26 ; ASTEXPR-NEXT: %tmp4_p_scalar_ = load float, ptr %polly.access.A, align 4, !alias.scope !2, !noalias !5
27 ; ASTEXPR-NEXT: %p_tmp5 = fadd float %tmp4_p_scalar_, 1.000000e+01
28 ; ASTEXPR-NEXT: %pexp.pdiv_r1 = urem i64 %polly.indvar, 4
29 ; ASTEXPR-NEXT: %polly.access.A2 = getelementptr float, ptr %A, i64 %pexp.pdiv_r1
30 ; ASTEXPR-NEXT: store float %p_tmp5, ptr %polly.access.A2, align 4, !alias.scope !2, !noalias !5
31 ; ASTEXPR-NEXT: %polly.indvar_next = add nsw i64 %polly.indvar, 1
32 ; ASTEXPR-NEXT: %polly.loop_cond = icmp sle i64 %polly.indvar_next, 99
33 ; ASTEXPR-NEXT: br i1 %polly.loop_cond, label %polly.loop_header, label %polly.loop_exit
35 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
37 define void @foo(ptr %A) {
41 bb1: ; preds = %bb6, %bb
42 %i.0 = phi i64 [ 0, %bb ], [ %tmp7, %bb6 ]
43 %exitcond = icmp ne i64 %i.0, 100
44 br i1 %exitcond, label %bb2, label %bb8
47 %tmp = srem i64 %i.0, 4
48 %tmp3 = getelementptr inbounds float, ptr %A, i64 %tmp
49 %tmp4 = load float, ptr %tmp3, align 4
50 %tmp5 = fadd float %tmp4, 1.000000e+01
51 store float %tmp5, ptr %tmp3, align 4
55 %tmp7 = add nuw nsw i64 %i.0, 1