Chris Lattner | 81ba704 | 2002-03-11 22:09:43 +0000 | [diff] [blame] | 1 | ; 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 Brukman | e78760e | 2003-09-16 15:29:54 +0000 | [diff] [blame] | 8 | ; RUN: llvm-as < %s | opt -constprop |
Chris Lattner | 81ba704 | 2002-03-11 22:09:43 +0000 | [diff] [blame] | 9 | |
| 10 | implementation |
| 11 | |
| 12 | void "build_tree"(int %ml) |
| 13 | begin |
| 14 | br label %bb2 |
| 15 | |
| 16 | bb2: |
| 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 | |
| 23 | bb3: |
| 24 | ret void |
| 25 | end |