Fix PR rtl-optimization/70886

Eric Botcazou ebotcazou@adacore.com
Mon May 2 07:12:00 GMT 2016


This is the bootstrap comparison failure on IA-64 after -frename-registers was 
enabled at -O2, but the issue has nothing to do with the pass.  It comes from 
the speculation support in the scheduler, namely from estimate_dep_weak:

/* Estimate the weakness of dependence between MEM1 and MEM2.  */
dw_t
estimate_dep_weak (rtx mem1, rtx mem2)
{
  rtx r1, r2;

  if (mem1 == mem2)
    /* MEMs are the same - don't speculate.  */
    return MIN_DEP_WEAK;

  r1 = XEXP (mem1, 0);
  r2 = XEXP (mem2, 0);

  if (r1 == r2
      || (REG_P (r1) && REG_P (r2)
	  && REGNO (r1) == REGNO (r2)))
    /* Again, MEMs are the same.  */
    return MIN_DEP_WEAK;

The pointer comparison is not stable for VALUEs when cselib is used (this is 
the business of canonical cselib values).  I tried rtx_equal_for_cselib_p here 
but this doesn't work because there are dangling VALUEs during scheduling 
(VALUEs whose associated cselib value has been reclaimed but still referenced 
as addresses of MEMs on lists).  Hence the attached patch, which canonicalizes 
the cselib values manually and fixes the comparison failure.

Bootstrapped/regtested on IA-64/Linux.  The patch also contains an unrelated 
micro-optimization for rtx_equal_for_cselib_p.  Thoughts?


2016-05-02  Eric Botcazou  <ebotcazou@adacore.com>

	PR rtl-optimization/70886
	* sched-deps.c (estimate_dep_weak): Canonicalize cselib values.

	* cselib.h (rtx_equal_for_cselib_1): Declare.
	(rtx_equal_for_cselib_p: New inline function.
	* cselib.c (rtx_equal_for_cselib_p): Delete.
	(rtx_equal_for_cselib_1): Make public.

-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr70886.diff
Type: text/x-patch
Size: 3865 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20160502/14d5076d/attachment.bin>


More information about the Gcc-patches mailing list