1; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
2
3; Test for a bug, which caused an assert when an invalid
4; SCEVAddRecExpr is created in addToCoefficient.
5
6; CHECK-LABEL: foo
7; CHECK: da analyze - consistent input [S 0]!
8; CHECK: da analyze - input [* *|<]!
9; CHECK: da analyze - none!
10
11define float @foo(float %g, [40 x float]* %rr) nounwind {
12entry:
13  br label %for.cond1.preheader
14
15for.cond1.preheader:
16  %i.04 = phi i32 [ 0, %entry ], [ %add10, %for.inc9 ]
17  %res.03 = phi float [ 0.000000e+00, %entry ], [ %add.res.1, %for.inc9 ]
18  br label %for.body3
19
20for.body3:
21  %j.02 = phi i32 [ 0, %for.cond1.preheader ], [ %add8, %for.body3 ]
22  %res.11 = phi float [ %res.03, %for.cond1.preheader ], [ %add.res.1, %for.body3 ]
23  %arrayidx4 = getelementptr inbounds [40 x float], [40 x float]* %rr, i32 %j.02, i32 %j.02
24  %0 = load float, float* %arrayidx4, align 4
25  %arrayidx6 = getelementptr inbounds [40 x float], [40 x float]* %rr, i32 %i.04, i32 %j.02
26  %1 = load float, float* %arrayidx6, align 4
27  %add = fadd float %0, %1
28  %cmp7 = fcmp ogt float %add, %g
29  %add.res.1 = select i1 %cmp7, float %add, float %res.11
30  %add8 = add nsw i32 %j.02, 5
31  %cmp2 = icmp slt i32 %add8, 40
32  br i1 %cmp2, label %for.body3, label %for.inc9
33
34for.inc9:
35  %add10 = add nsw i32 %i.04, 5
36  %cmp = icmp slt i32 %add10, 40
37  br i1 %cmp, label %for.cond1.preheader, label %for.end11
38
39for.end11:
40  ret float %add.res.1
41}
42