> Now with patch > > On Fri, May 11, 2012 at 8:42 PM, Steven Bosscher <stevenb....@gmail.com> > wrote: >>>>> 2012-05-10 Vladimir Makarov<vmaka...@redhat.com> >>>>> >>>>> PR rtl-optimization/53125 >>>>> * ira.c (ira): Call find_moveable_pseudos and >>>>> move_unallocated_pseudos if only ira_conflicts_p is true. >> And the attached patch fixes the reginfo slowness. >> >> The reginfo pass was doing: >> >> for each bb: >> for each insn in bb, from BB_END(bb) to BB_HEAD(bb): >> for each reg that died between BB_END(bb) and insn: // i.e. >> register is live at insn >> REG_LIVE_LENGTH(reg)++ >> >> With very large basic blocks, and the kind of code for the test case >> of the PR results in many live registers for SPARC (for x86_64 there >> are far fewer live registers). For SPARC, there are O(1e5) insns and >> O(1e4) registers live for most of the basic block. That is effectively >> almost quadratic behavior in the number of insns per basic block. >> >> But the above loop is a bit silly. It is much easier and >> computationally cheaper to just remember at what insn reg died (last >> used), and add to REG_LIVE_LENGTH the distance from the insn that sets >> reg to the insn that used reg.
Yes, this makes a lot of sense. Patch ok with one typo fixed. >> It turns out that (before or after the patch) partial or conditional >> sets never kill a register, so that REG_LIVE_LENGTH for registers set >> by partial or conditional stores is not very accurate. But this is correct, isn't it? The live range for such registers is indeed extending before and after the store. > @@ -310,22 +322,26 @@ regstat_bb_compute_ri (unsigned int bb_i > > if (bitmap_set_bit (live, uregno)) > { > - /* This register is now live. */ > + /* This register is now live. Begin to process it locally. > > - /* If we have seen this regno, then it has already been > - processed correctly with the per insn increment. If > - we have not seen it we set the bit so that begins to > - get processed locally. Note that we don't even get > - here if the variable was live at the end of the block > - since just a ref inside the block does not effect the > - calculations. */ > + Note that we don't even get here if the variable was live > + at the end of the block since just a ref inside the block > + does not effect the calculations. */ > REG_LIVE_LENGTH (uregno) ++; > + local_live_last_luid[uregno] = luid; > bitmap_set_bit (local_live, uregno); > bitmap_set_bit (local_processed, uregno); > } > } > } > > + /* Add the liveness length to all registers that were used somewhere > + in this bock, but not between that use and the head of this block. */ Typo is here ("bock"->"block"). Paolo