xref: /llvm-project/polly/test/ScopInfo/parameter_with_constant_factor_in_add.ll (revision e1f056f692d869708c1898d9d65a69ac5584a0ed)
1; RUN: opt %loadNPMPolly '-passes=print<polly-function-scops>' -disable-output < %s 2>&1 | FileCheck %s
2;
3; Check that the access function of the store is simple and concise
4;
5; CHECK: p0: {0,+,(-1 + (sext i32 (-1 * %smax188) to i64))<nsw>}<%for.cond261.preheader>
6;
7; CHECK:      MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
8; CHECK-NEXT:   [p_0] -> { Stmt_for_body276[i0] -> MemRef_A[p_0] };
9;
10; ModuleID = 'bugpoint-reduced-simplified.bc'
11target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
12
13; Function Attrs: nounwind uwtable
14define void @BPredPartitionCost(ptr %A) #0 {
15entry:
16  %curr_blk = alloca [16 x [16 x i32]], align 16
17  br label %for.cond261.preheader.lr.ph
18
19for.cond261.preheader.lr.ph:                      ; preds = %entry
20  %smax188 = select i1 undef, i32 undef, i32 -9
21  %0 = sub i32 0, %smax188
22  %1 = sext i32 %0 to i64
23  %2 = add i64 %1, -1
24  br label %for.cond261.preheader
25
26for.cond261.preheader:                            ; preds = %for.inc299, %for.cond261.preheader.lr.ph
27  %indvars.iv189 = phi i64 [ 0, %for.cond261.preheader.lr.ph ], [ %indvars.iv.next190, %for.inc299 ]
28  br i1 undef, label %for.cond273.preheader, label %for.inc299
29
30for.cond273.preheader:                            ; preds = %for.cond261.preheader
31  br label %for.body276
32
33for.body276:                                      ; preds = %for.body276, %for.cond273.preheader
34  %indvars.iv = phi i64 [ 0, %for.cond273.preheader ], [ %indvars.iv.next, %for.body276 ]
35  %3 = add nsw i64 0, %indvars.iv189
36  %arrayidx282 = getelementptr inbounds [16 x [16 x i32]], ptr %curr_blk, i64 0, i64 %3, i64 0
37  %4 = load i32, ptr %arrayidx282, align 4
38  %arridx = getelementptr i32, ptr %A, i64 %3
39  store i32 0, ptr %arridx, align 4
40  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
41  br i1 false, label %for.body276, label %for.end291
42
43for.end291:                                       ; preds = %for.body276
44  ret void
45
46for.inc299:                                       ; preds = %for.cond261.preheader
47  %indvars.iv.next190 = add i64 %indvars.iv189, %2
48  br i1 undef, label %for.cond261.preheader, label %if.end302
49
50if.end302:                                        ; preds = %for.inc299
51  ret void
52}
53