blob: 62435747c23b719e8786bf0da380d33bc79098ee [file] [log] [blame]
Chris Lattner81ba7042002-03-11 22:09:43 +00001; When constant propogating terminator instructions, the basic block iterator
2; was not updated to refer to the final position of the new terminator. This
3; can be bad, f.e. because constproping a terminator can lead to the
4; destruction of PHI nodes, which invalidates the iterator!
5;
6; Fixed by adding new arguments to ConstantFoldTerminator
7;
Misha Brukmane78760e2003-09-16 15:29:54 +00008; RUN: llvm-as < %s | opt -constprop
Chris Lattner81ba7042002-03-11 22:09:43 +00009
10implementation
11
12void "build_tree"(int %ml)
13begin
14 br label %bb2
15
16bb2:
17 %reg137 = phi int [ %reg140, %bb2 ], [ 12, %0 ] ; <int> [#uses=2]
18 %reg138 = phi uint [ %reg139, %bb2 ], [ 0, %0 ] ; <uint> [#uses=3]
19 %reg139 = add uint %reg138, 1 ; <uint> [#uses=1]
20 %reg140 = add int %reg137, -1 ; <int> [#uses=1]
21 br bool false, label %bb2, label %bb3
22
23bb3:
24 ret void
25end