Max Kazantsev | fa49695 | 2017-07-28 06:42:15 +0000 | [diff] [blame] | 1 | ; RUN: opt -loop-unroll -loop-simplify -S < %s | FileCheck %s |
| 2 | |
| 3 | ; This test is one of the tests of PR33494. Its compilation takes |
| 4 | ; excessive time if we don't mark visited nodes while looking for |
| 5 | ; constants in SCEV expression trees. |
| 6 | |
| 7 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 8 | target triple = "x86_64-unknown-linux-gnu" |
| 9 | |
| 10 | define void @test_01(i32* nocapture %a) local_unnamed_addr { |
| 11 | |
| 12 | ; CHECK-LABEL: @test_01( |
| 13 | |
| 14 | entry: |
| 15 | %arrayidx = getelementptr inbounds i32, i32* %a, i64 96 |
| 16 | %arrayidx.promoted51 = load i32, i32* %arrayidx, align 1 |
| 17 | br label %while.body |
| 18 | |
| 19 | while.body: ; preds = %entry, %while.end29 |
| 20 | %0 = phi i32 [ %arrayidx.promoted51, %entry ], [ %7, %while.end29 ] |
| 21 | %cmp46 = icmp eq i32 %0, 1 |
| 22 | %conv47 = zext i1 %cmp46 to i32 |
| 23 | %1 = add i32 %0, 1 |
| 24 | %2 = icmp ult i32 %1, 3 |
| 25 | %div48 = select i1 %2, i32 %0, i32 0 |
| 26 | %cmp349 = icmp sgt i32 %div48, %conv47 |
| 27 | br i1 %cmp349, label %while.body4.lr.ph, label %while.end29 |
| 28 | |
| 29 | while.body4.lr.ph: ; preds = %while.body |
| 30 | br label %while.body4 |
| 31 | |
| 32 | while.body4: ; preds = %while.body4.lr.ph, %while.end28 |
| 33 | %3 = phi i32 [ %0, %while.body4.lr.ph ], [ %mul17.lcssa, %while.end28 ] |
| 34 | br label %while.body13 |
| 35 | |
| 36 | while.body13: ; preds = %while.body4, %while.end.split |
| 37 | %mul1745 = phi i32 [ %3, %while.body4 ], [ %mul17, %while.end.split ] |
| 38 | %4 = phi i32 [ 15872, %while.body4 ], [ %add, %while.end.split ] |
| 39 | %mul = mul nsw i32 %mul1745, %mul1745 |
| 40 | %mul17 = mul nsw i32 %mul, %mul1745 |
| 41 | %cmp22 = icmp eq i32 %4, %mul17 |
| 42 | br i1 %cmp22, label %while.body13.split, label %while.end.split |
| 43 | |
| 44 | while.body13.split: ; preds = %while.body13 |
| 45 | br label %while.cond19 |
| 46 | |
| 47 | while.cond19: ; preds = %while.cond19, %while.body13.split |
| 48 | br label %while.cond19 |
| 49 | |
| 50 | while.end.split: ; preds = %while.body13 |
| 51 | %add = shl nsw i32 %4, 1 |
| 52 | %tobool12 = icmp eq i32 %add, 0 |
| 53 | br i1 %tobool12, label %while.end28, label %while.body13 |
| 54 | |
| 55 | while.end28: ; preds = %while.end.split |
| 56 | %add.lcssa = phi i32 [ %add, %while.end.split ] |
| 57 | %mul17.lcssa = phi i32 [ %mul17, %while.end.split ] |
| 58 | %cmp = icmp eq i32 %mul17.lcssa, 1 |
| 59 | %conv = zext i1 %cmp to i32 |
| 60 | %5 = add i32 %mul17.lcssa, 1 |
| 61 | %6 = icmp ult i32 %5, 3 |
| 62 | %div = select i1 %6, i32 %mul17.lcssa, i32 0 |
| 63 | %cmp3 = icmp sgt i32 %div, %conv |
| 64 | br i1 %cmp3, label %while.body4, label %while.cond1.while.end29_crit_edge |
| 65 | |
| 66 | while.cond1.while.end29_crit_edge: ; preds = %while.end28 |
| 67 | %.lcssa = phi i32 [ %mul17.lcssa, %while.end28 ] |
| 68 | %add.lcssa50.lcssa = phi i32 [ %add.lcssa, %while.end28 ] |
| 69 | store i32 %add.lcssa50.lcssa, i32* %a, align 4 |
| 70 | br label %while.end29 |
| 71 | |
| 72 | while.end29: ; preds = %while.cond1.while.end29_crit_edge, %while.body |
| 73 | %7 = phi i32 [ %.lcssa, %while.cond1.while.end29_crit_edge ], [ %0, %while.body ] |
| 74 | br label %while.body |
| 75 | } |