PR middle-end/51472: set DECL_GIMPLE_REG_P on TM vector saves

Richard Guenther richard.guenther@gmail.com
Wed Dec 21 09:48:00 GMT 2011


On Tue, Dec 20, 2011 at 5:57 PM, Aldy Hernandez <aldyh@redhat.com> wrote:
> The problem here is a verify_gimple ICE because a vector store's LHS is not
> a gimple register, but the vector type is a gimple_reg_type.
>
>     if (!is_gimple_reg (lhs)
>          && is_gimple_reg_type (TREE_TYPE (lhs)))
>        {
>          error ("invalid rhs for gimple memory store");
>          debug_generic_stmt (lhs);
>          debug_generic_stmt (rhs1);
>          return true;
>        }
>
> The reason that is_gimple_reg() is false, is because the vector variable is
> not marked as DECL_GIMPLE_REG_P.  If I understand DECL_GIMPLE_REG_P
> correctly, it should be true, since the TM saves/restores are not aliased
> and the only store to them are killing assignments.
>
> I also noticed we didn't call update_stmt() after gimple_assign_set_lhs(),
> so I have called it.  However, this part is not strictly necessary for the
> patch.
>
> The attached patch fixes the PR, and causes no regressions to the TM
> testsuite.
>
> OK pending further tests?

You can't simply do

+	  if (TREE_CODE (TREE_TYPE (var)) == COMPLEX_TYPE
+	      || TREE_CODE (TREE_TYPE (var)) == VECTOR_TYPE)
+	    DECL_GIMPLE_REG_P (var) = 1;
+	  update_stmt (stmt);

where is 'var' created?  At _that_ point you should do the above
(or use create_tmp_reg instead of create_tmp_var).  Existing uses
of var might prevent DECL_GIMPLE_REG_P from being set
(which also means creating an SSA name of it is not allowed).

Richard.



More information about the Gcc-patches mailing list