1; RUN: opt %loadPolly -polly-detect < %s
2
3; This test case helps to determine wether SCEVRemoveMax::remove produces
4; an infinite loop and a segmentation fault, if it processes, for example,
5; '((-1 + (-1 * %b1)) umax {(-1 + (-1 * %yStart)),+,-1}<%.preheader>)'.
6;
7; In this case, the SCoP is invalid. However, SCoP detection failed when
8; running over it.
9
10target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
11target triple = "x86_64-unknown-linux-gnu"
12
13@vertPlane = external global i8*, align 8
14
15define fastcc void @Maze2Mech(i64 %i, i64 %b1, i64 %yStart) {
16.split:
17  br i1 undef, label %DrawSegment.exit, label %DrawSegment.exit34
18
19DrawSegment.exit34:                               ; preds = %.split
20  %tmp = icmp ugt i64 %yStart, %b1
21  %tmp1 = select i1 %tmp, i64 %b1, i64 %yStart
22  %tmp2 = load i8*, i8** @vertPlane, align 8
23  %y.04.i21 = add i64 %tmp1, 1
24  br label %.lr.ph.i24
25
26.lr.ph.i24:                                       ; preds = %.lr.ph.i24, %DrawSegment.exit34
27  %y.05.i22 = phi i64 [ %y.0.i23, %.lr.ph.i24 ], [ %y.04.i21, %DrawSegment.exit34 ]
28  %tmp3 = mul i64 %y.05.i22, undef
29  %tmp4 = add i64 %tmp3, %i
30  %tmp5 = getelementptr inbounds i8, i8* %tmp2, i64 %tmp4
31  %tmp6 = load i8, i8* %tmp5, align 1
32  %y.0.i23 = add nuw i64 %y.05.i22, 1
33  br i1 false, label %bb, label %.lr.ph.i24
34
35bb:                                               ; preds = %.lr.ph.i24
36  unreachable
37
38DrawSegment.exit:                                 ; preds = %.split
39  ret void
40}
41