Fix bug in register renaming pass

Eric Botcazou ebotcazou@adacore.com
Tue Nov 25 23:37:00 GMT 2008


This is a bug introduced by the conversion to the new DF framework; it is 
responsible for the following Objective-C regressions on mainline and 4.3:

FAIL: objc/execute/exceptions/foward-1.m 
execution,  -O3 -fomit-frame-pointer -funroll-loops -fgnu-runtime
FAIL: objc/execute/exceptions/foward-1.m 
execution,  -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions -fgnu-runtime

It's again the EH_RETURN_DATA_REGNO business.  With the flow.c approach, uses 
of EH_RETURN_DATA_REGNO registers were creating live ranges up to the start 
of basic blocks with incoming EH edges so these registers were appearing as 
live in merge_overlapping_regs:

/* For a def-use chain CHAIN in basic block B, find which registers overlap
   its lifetime and set the corresponding bits in *PSET.  */

static void
merge_overlapping_regs (basic_block b, HARD_REG_SET *pset,
			struct du_chain *chain)
{
  struct du_chain *t = chain;
  rtx insn;
  HARD_REG_SET live;

  REG_SET_TO_HARD_REG_SET (live, b->il.rtl->global_live_at_start);
  insn = BB_HEAD (b);


The new code is:

  REG_SET_TO_HARD_REG_SET (live, df_get_live_in (b));
  insn = BB_HEAD (b);

The problem is that EH_RETURN_DATA_REGNO registers cannot be in LIVE IN since 
they are deemed artificial defs, that is defined just before the first insn.

Hence the attached fix, tested on i586-suse-linux and sparc-sun-solaris2.10, 
applied on the mainline and 4.3 branch.


2008-11-25  Eric Botcazou  <ebotcazou@adacore.com>

	* regrename.c (merge_overlapping_regs): Add registers artificially
	defined at the top of the basic block to the set of live ones just
	before the first insn.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: regrename.diff
Type: text/x-diff
Size: 612 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20081125/d020b8db/attachment.bin>


More information about the Gcc-patches mailing list