blob: 07a942f70bd25a923dbb21c6676f2b236566c5fa [file] [log] [blame]
Dan Gohman3e054fe2009-09-08 22:34:10 +00001; RUN: opt < %s -loop-reduce -S | grep phi | count 1
Dan Gohmancbfe5bb2008-06-22 20:44:02 +00002
3define void @foo(i32 %n) {
4entry:
5 br label %loop
6
7loop:
8 %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
9
10 ; These three instructions form an isolated cycle and can be deleted.
11 %j = phi i32 [ 0, %entry ], [ %j.y, %loop ]
12 %j.x = add i32 %j, 1
13 %j.y = mul i32 %j.x, 2
14
15 %i.next = add i32 %i, 1
16 %c = icmp ne i32 %i.next, %n
17 br i1 %c, label %loop, label %exit
18
19exit:
20 ret void
21}