[patch] Small tweak to gimplifier

Eric Botcazou ebotcazou@adacore.com
Tue Jun 2 09:29:00 GMT 2015


Hi,

there is a trick in the gimplifier to alleviate some annoying effects of the 
gimplification on the debug info (for -O0 when var-tracking is not enabled but 
it's done unconditionally):

  /* Try to alleviate the effects of the gimplification creating artificial
     temporaries (see for example is_gimple_reg_rhs) on the debug info.  */
  if (!gimplify_ctxp->into_ssa
      && TREE_CODE (*from_p) == VAR_DECL
      && DECL_IGNORED_P (*from_p)
      && DECL_P (*to_p)
      && !DECL_IGNORED_P (*to_p))
    {
      if (!DECL_NAME (*from_p) && DECL_NAME (*to_p))
	DECL_NAME (*from_p)
	  = create_tmp_var_name (IDENTIFIER_POINTER (DECL_NAME (*to_p)));
      DECL_HAS_DEBUG_EXPR_P (*from_p) = 1;
      SET_DECL_DEBUG_EXPR (*from_p, *to_p);
   }

We have a large Ada testcase for which this creates a GC hazard in LTO mode 
because this creates a DECL_DEBUG_EXPR link between a parent and a nested 
function, which badly interacts with a DECL_VALUE_EXPR link created during 
unnesting (it's the known GC issue with circular references through hash 
tables in GC memory).

Therefore the attached patch restricts the trick to local variables only.
That's transparent, modulo a benign tweak to gcc.dg/vect/vec-scal-opt.c 
because of the DECL_NAME change.

Tested on x86_64-suse-linux, OK for the mainline?


2015-06-02  Eric Botcazou  <ebotcazou@adacore.com>

	* gimplify.c (gimplify_modify_expr): Do not create a DECL_DEBUG_EXPR if
	the target doesn't belong to the current function.


2015-06-02  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc.dg/vect/vec-scal-opt.c: Adjust regexp.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-patch
Size: 1416 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20150602/1f5110d1/attachment.bin>


More information about the Gcc-patches mailing list