Hi, > This patch fixes the build failure of gcc spec2006 benchmark. > The change is in gimple_duplicate_sese_tail(), where we need to subtract > 1 from the loop's number of iterations. > The stmt created to change the rhs of the loop's condition, used to be > inserted right after the defining stmt of the rhs (an ssa name). > This requires special handling of different cases of the defining stmt: > 1.gimple_stmt > 2.gimple_phi > 3.default_def > > Instead of handling each case separately, if we insert the new stmt at the > begining of the loop's preheader, we're sure that > it's already been defined. > > Bootstrap and testsuite pass successfully (as autopar is not enabled by > default). > No new regressions when the testsuite is run with autopar enabled. > No new regressions for the run of spec2006 with autopar enabled, and gcc > benchmark now passes successfully.. > > OK for trunk?
actually, I think a better approach would be not to have this kind of pass-specific adjustments in gimple_duplicate_sese_tail at all. The code decreasing the number of iterations in gimple_duplicate_sese_tail only works because parloops does induction variable canonicalization first; should we need it to be used anywhere else, it will break. I.e., parloops should first transform the condition so that it does the comparison with the adjusted value, and then gimple_duplicate_sese_tail could do just code copying and cfg changes, Zdenek