1; RUN: opt -analyze -scalar-evolution < %s | FileCheck %s
2
3target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128-ni:1"
4
5; Check that we don't have unreasonably huge SCEVs and in particular only a
6; reasonable amount of AddRecs in the notation of %tmp19. If we "simplify" SCEVs
7; too aggressively, we may end up with huge nested expressions.
8define void @test(i32 %x, i64 %y, i1 %cond) {
9
10; CHECK: %tmp19 = mul i32 %tmp17, %tmp18
11; CHECK: ((((((
12; CHECK-NOT: (((((
13; CHECK: %tmp20 = add i32 %tmp19, %x
14
15bb:
16  br label %bb1
17
18bb1:                                              ; preds = %bb3, %bb
19  %tmp = phi i64 [ %y, %bb ], [ %tmp22, %bb3 ]
20  %tmp2 = phi i32 [ %x, %bb ], [ %tmp4, %bb3 ]
21  br label %bb5
22
23bb3:                                              ; preds = %bb5
24  %tmp4 = add i32 %tmp2, %x
25  br label %bb1
26
27bb5:                                              ; preds = %bb5, %bb1
28  %tmp6 = phi i32 [ %tmp23, %bb5 ], [ %tmp2, %bb1 ]
29  %tmp7 = sub i32 -119, %tmp6
30  %tmp8 = mul i32 %tmp7, %x
31  %tmp9 = sub i32 -120, %tmp6
32  %tmp10 = mul i32 %tmp8, %tmp9
33  %tmp11 = mul i32 %x, %tmp10
34  %tmp12 = sub i32 -121, %tmp6
35  %tmp13 = mul i32 %tmp10, %tmp12
36  %tmp14 = mul i32 %tmp11, %tmp13
37  %tmp15 = sub i32 -122, %tmp6
38  %tmp16 = mul i32 %tmp13, %tmp15
39  %tmp17 = mul i32 %tmp14, %tmp16
40  %tmp18 = mul i32 %tmp16, %x
41  %tmp19 = mul i32 %tmp17, %tmp18
42  %tmp20 = add i32 %tmp19, %x
43  %tmp21 = sext i32 %tmp20 to i64
44  %tmp22 = add i64 %y, %tmp21
45  %tmp23 = add i32 %tmp6, 7
46  br i1 %cond, label %bb5, label %bb3
47}
48