On 27-03-15 15:10, Tom de Vries wrote: > Hi, > > this patch fixes PR65443, a todo in the parloops pass for function > transform_to_exit_first_loop: > ... > TODO: the common case is that latch of the loop is empty and immediately > follows the loop exit. In this case, it would be better not to copy the > body of the loop, but only move the entry of the loop directly before the > exit check and increase the number of iterations of the loop by one. > This may need some additional preconditioning in case NIT = ~0. > ... > > The current implementation of transform_to_exit_first_loop transforms the loop > by moving and duplicating the loop body. This patch transforms the loop into the > same normal form, but without the duplication, if that's possible (determined by > try_transform_to_exit_first_loop_alt). > > The actual transformation, done by transform_to_exit_first_loop_alt transforms > this loop: > ... > bb preheader: > ... > goto > > : > ... > if (ivtmp < n) > goto ; > else > goto ; > > : > ivtmp = ivtmp + inc; > goto > ... > > into this one: > ... > bb preheader: > ... > goto > > : > ... > goto ; > > : > if (ivtmp < n + 1) > goto ; > else > goto ; > > : > ivtmp = ivtmp + inc; > goto > ... > Updated patch, now using redirect_edge_var_map and flush_pending_stmts. Bootstrapped and reg-tested on x86_64. OK for stage1 trunk? Thanks, - Tom