1; RUN: opt < %s -indvars -S | FileCheck %s
2
3target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
4target triple = "x86_64-unknown-linux-gnu"
5
6; This test takes excessively long time if SCEV tries to construct huge
7; SCEVMulExpr's (with ~1000 ops) due to non-linear analysis cost.
8define i32 @test() {
9; CHECK-LABEL: @test(
10bci_0:
11  br label %bci_12
12
13bci_133:                                          ; preds = %bci_127.unr-lcssa
14  ret i32 %tmp17
15
16bci_12:                                           ; preds = %bci_127.unr-lcssa, %bci_0
17  %indvars.iv184 = phi i64 [ %indvars.iv.next185, %bci_127.unr-lcssa ], [ 3, %bci_0 ]
18  %tmp1 = trunc i64 %indvars.iv184 to i32
19  br label %bci_55.postloop
20
21bci_127.unr-lcssa:                                ; preds = %bci_90.postloop
22  %indvars.iv.next185 = add nuw nsw i64 %indvars.iv184, 1
23  %tmp4 = icmp sgt i64 %indvars.iv184, 91
24  br i1 %tmp4, label %bci_133, label %bci_12
25
26bci_55.postloop:                                  ; preds = %bci_90.postloop, %bci_12
27  %indvars.iv180.postloop = phi i64 [ %indvars.iv.next181.postloop, %bci_90.postloop ], [ 15, %bci_12 ]
28  %local_2_16.postloop = phi i32 [ %tmp17, %bci_90.postloop ], [ 4, %bci_12 ]
29  %indvars.iv.next181.postloop = add nuw nsw i64 %indvars.iv180.postloop, 1
30  %tmp6 = load i32, i32 addrspace(1)* undef, align 4
31  %tmp7 = mul i32 %tmp6, %tmp1
32  br label %not_zero65.us.postloop
33
34not_zero65.us.postloop:                           ; preds = %not_zero65.us.postloop.1, %bci_55.postloop
35  %local_2_24.us.postloop = phi i32 [ %local_2_16.postloop, %bci_55.postloop ], [ %tmp49, %not_zero65.us.postloop.1 ]
36  %local_6_.us.postloop = phi i32 [ 3, %bci_55.postloop ], [ %tmp50, %not_zero65.us.postloop.1 ]
37  %tmp8 = mul i32 %tmp7, %local_2_24.us.postloop
38  %tmp9 = mul i32 %tmp8, %local_2_24.us.postloop
39  %tmp10 = mul i32 %tmp7, %tmp9
40  %tmp11 = mul i32 %tmp10, %tmp9
41  %tmp12 = mul i32 %tmp7, %tmp11
42  %tmp13 = mul i32 %tmp12, %tmp11
43  %tmp14 = mul i32 %tmp7, %tmp13
44  %tmp15 = mul i32 %tmp14, %tmp13
45  %tmp16 = mul i32 %tmp7, %tmp15
46  %tmp17 = mul i32 %tmp16, %tmp15
47  %tmp18 = icmp sgt i32 %local_6_.us.postloop, 82
48  br i1 %tmp18, label %bci_90.postloop, label %not_zero65.us.postloop.1
49
50bci_90.postloop:                                  ; preds = %not_zero65.us.postloop
51  %tmp19 = icmp sgt i64 %indvars.iv180.postloop, 68
52  br i1 %tmp19, label %bci_127.unr-lcssa, label %bci_55.postloop
53
54not_zero65.us.postloop.1:                         ; preds = %not_zero65.us.postloop
55  %tmp20 = mul i32 %tmp7, %tmp17
56  %tmp21 = mul i32 %tmp20, %tmp17
57  %tmp22 = mul i32 %tmp7, %tmp21
58  %tmp23 = mul i32 %tmp22, %tmp21
59  %tmp24 = mul i32 %tmp7, %tmp23
60  %tmp25 = mul i32 %tmp24, %tmp23
61  %tmp26 = mul i32 %tmp7, %tmp25
62  %tmp27 = mul i32 %tmp26, %tmp25
63  %tmp28 = mul i32 %tmp7, %tmp27
64  %tmp29 = mul i32 %tmp28, %tmp27
65  %tmp30 = mul i32 %tmp7, %tmp29
66  %tmp31 = mul i32 %tmp30, %tmp29
67  %tmp32 = mul i32 %tmp7, %tmp31
68  %tmp33 = mul i32 %tmp32, %tmp31
69  %tmp34 = mul i32 %tmp7, %tmp33
70  %tmp35 = mul i32 %tmp34, %tmp33
71  %tmp36 = mul i32 %tmp7, %tmp35
72  %tmp37 = mul i32 %tmp36, %tmp35
73  %tmp38 = mul i32 %tmp7, %tmp37
74  %tmp39 = mul i32 %tmp38, %tmp37
75  %tmp40 = mul i32 %tmp7, %tmp39
76  %tmp41 = mul i32 %tmp40, %tmp39
77  %tmp42 = mul i32 %tmp7, %tmp41
78  %tmp43 = mul i32 %tmp42, %tmp41
79  %tmp44 = mul i32 %tmp7, %tmp43
80  %tmp45 = mul i32 %tmp44, %tmp43
81  %tmp46 = mul i32 %tmp7, %tmp45
82  %tmp47 = mul i32 %tmp46, %tmp45
83  %tmp48 = mul i32 %tmp7, %tmp47
84  %tmp49 = mul i32 %tmp48, %tmp47
85  %tmp50 = add nsw i32 %local_6_.us.postloop, 20
86  br label %not_zero65.us.postloop
87}
88