[PATCH] Fix PR tree-opt/30930, vector can cause to create an extra variable, DECL_GIMPLE_REG_P not recomputed

Richard Guenther richard.guenther@gmail.com
Fri Sep 19 10:29:00 GMT 2008


On Thu, Sep 18, 2008 at 10:36 PM, Andrew Pinski <pinskia@gmail.com> wrote:
> Hi,
>  This bug is about the case where DECL_GIMPLE_REG_P is not recomputed
> which causes some missed optimizations and extra variables to be
> around during expansion time.  The way I filed it is to recompute it
> during update_addresses_taken.  This allows us to better inline in
> some cases and also allows for other optimizations later on.
>
> Also this is infrastructure which is needed to allow DECL_GIMPLE_REG_P
> on other types besides vector/complex types which is needed to allow
> VCE on the LHS.  Since we already need to make sure that
> DECL_GIMPLE_REG_P is set on complex type decl that use
> REAL_EXPR/IMAG_EXPR on the LHS, likewise for BIT_FIELD_REF for vector
> type decls, the check to see if that appears on the LHS.
>
> OK? Bootstrapped and tested on i386-darwin with no regressions.

+	      bitmap_ior_into (addresses_taken, taken);
+	      bitmap_ior_into (not_reg_needs, taken);

Can you instead of duplicating the address-taken bits in not-reg-needs
just query both bitmaps in the end like

  FOR_EACH_REFERENCED_VAR (var, rvi)
    {
        if (TREE_CODE (var) == RESULT_DECL
           || (TREE_ADDRESSABLE (var)
	      && bitmap_bit_p (addresses_taken, DECL_UID (var)))
            || is_global_var (var))
          continue;
      if (TREE_ADDRESSABLE (var))
	{
	  TREE_ADDRESSABLE (var) = 0;
...

      if (!DECL_GIMPLE_REG_P (var)
	  && !bitmap_bit_p (not_reg_needs, DECL_UID (var))
	  && (TREE_CODE (TREE_TYPE (var)) == COMPLEX_TYPE
	      || TREE_CODE (TREE_TYPE (var)) == VECTOR_TYPE))
	{
	  DECL_GIMPLE_REG_P (var) = 1;
	  if (is_gimple_reg (var))

the is_gimple_reg check looks superfluous.

	    mark_sym_for_renaming (var);


Ok with these changes.  Btw, tree-ssa-alias.c:mark_non_addressable
also misses to do this update.

Thanks,
Richard.

> Thanks,
> Andrew Pinski
>
> ChangeLog:
>
> * tree-ssa.c (execute_update_addresses_taken): Also update
> DECL_GIMPLE_REG_P for vector and complex types.
>
> testsuite/ChangeLog:
>
> * gcc.dg/tree-ssa/vector-2.c: New test.
> * gcc.dg/tree-ssa/vector-3.c: New test.
>



More information about the Gcc-patches mailing list