1; RUN: opt %loadPolly -polly-detect -\
2; RUN:     -analyze < %s | FileCheck %s
3
4; CHECK: Valid Region for Scop: bb11 => bb25
5
6; Ensure that this test case does not trigger an assertion. At some point,
7; we asserted on scops containing accesses where the access function contained
8; an AddRec expression with a non-constant step expression. This got missed, as
9; this very specific pattern does not seem too common. Even in this test case,
10; it disappears as soon as we turn the infinite loop into a finite loop.
11
12target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
13target triple = "x86_64-unknown-linux-gnu"
14
15define void @hoge() local_unnamed_addr {
16bb:
17  %tmp = alloca [18 x [16 x i32]]
18  %tmp1 = alloca [17 x i32]
19  br label %bb2
20
21bb2:
22  %tmp3 = phi i64 [ 0, %bb ], [ %tmp5, %bb2 ]
23  %tmp4 = add nuw nsw i64 %tmp3, 2
24  %tmp5 = add nuw nsw i64 %tmp3, 1
25  br i1 undef, label %bb2, label %bb11
26
27bb11:
28  %tmp12 = phi i64 [ %tmp23, %bb24 ], [ 1, %bb2 ]
29  %tmp14 = getelementptr inbounds [17 x i32], [17 x i32]* %tmp1, i64 0, i64 1
30  br label %bb15
31
32bb15:
33  %tmp16 = sub nsw i64 %tmp12, 1
34  %tmp17 = shl i64 %tmp16, 32
35  %tmp18 = ashr exact i64 %tmp17, 32
36  %tmp19 = getelementptr inbounds [18 x [16 x i32]], [18 x [16 x i32]]* %tmp, i64 0, i64 %tmp4, i64 %tmp18
37  %tmp20 = load i32, i32* %tmp19, align 4
38  store i32 4, i32* %tmp19
39  br label %bb21
40
41bb21:
42  %tmp23 = add nuw nsw i64 %tmp12, 1
43  br i1 true, label %bb24, label %bb25
44
45bb24:
46  br label %bb11
47
48bb25:
49  ret void
50}
51