# HG changeset patch # User Max Brister # Date 1346195557 21600 # Node ID 4c0cef65c55fbb9c121d5f6ffd8ab67bbf54c5ab # Parent c16357c4bdbb488e87ee1839170c8d1526db95b6 pt-jit.cc (jit_infer::do_construct_ir): Correct extraious phi removal diff -r c16357c4bdbb -r 4c0cef65c55f libinterp/interp-core/pt-jit.cc --- a/libinterp/interp-core/pt-jit.cc Tue Aug 28 11:00:53 2012 -0400 +++ b/libinterp/interp-core/pt-jit.cc Tue Aug 28 17:12:37 2012 -0600 @@ -1287,17 +1287,16 @@ { jit_phi *phi = static_cast (*iter); jit_variable *var = phi->dest (); + ++iter; + if (var->has_top ()) - { - phi->add_incomming (&ablock, var->top ()); - ++iter; - } + phi->add_incomming (&ablock, var->top ()); else { // temporaries may have extranious phi nodes which can be removed assert (! phi->use_count ()); assert (var->name ().size () && var->name ()[0] == '#'); - iter = finish->remove (iter); + phi->remove (); } } } @@ -2042,4 +2041,15 @@ %!assert (bubble (), [1 2 3]); +%!test +%! a = 0; +%! b = 1; +%! for i=1:1e3 +%! for j=1:2 +%! a = a + b; +%! endfor +%! endfor +%! assert (a, 2000); +%! assert (b, 1); + */