https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70499

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
einline produces the broken SSA name initially (in some way).  Created by

#2  0x0000000000da59f9 in gimple_regimplify_operands (stmt=
    <gimple_call 0x7ffff515bab0>, gsi_p=0x7fffffff8c50)
    at /space/rguenther/src/svn/trunk/gcc/gimplify-me.c:303
303                     temp = make_ssa_name (temp);
(gdb) l
298                 }
299               if (need_temp)
300                 {
301                   tree temp = create_tmp_reg (TREE_TYPE (lhs));
302                   if (gimple_in_ssa_p (cfun))
303                     temp = make_ssa_name (temp);
304                   gimple_set_lhs (stmt, temp);
305                   post_stmt = gimple_build_assign (lhs, temp);
(gdb) p debug_gimple_stmt (stmt)
# .MEM = VDEF <.MEM>
MEM[(struct SIMD *)_1] = SIMD::operator* (&hx, hy);

the code is really weird.

              if (is_gimple_reg_type (TREE_TYPE (lhs)))
                need_temp = true;
              else if (TYPE_MODE (TREE_TYPE (lhs)) != BLKmode)
                {
                  if (is_gimple_call (stmt))
                    {
                      tree fndecl = gimple_call_fndecl (stmt);

                      if (!aggregate_value_p (TREE_TYPE (lhs), fndecl)
                          && !(fndecl && DECL_RESULT (fndecl)
                               && DECL_BY_REFERENCE (DECL_RESULT (fndecl))))
                        need_temp = true;
                    }
                  else
                    need_temp = true;
                }

the is_gimple_reg_type case should be the only thing necessary.  But the
whole function is a totally weird beast.  I'm not going to touch that
but try papering over this mess in some way (probably how this shit
evolved...).

So instead of the above we'll get re-gimplified

  D.27340 = SIMD::operator* (&hx, hy);
  MEM[(struct SIMD *)_1] = D.27340;


Index: gcc/gimplify-me.c
===================================================================
--- gcc/gimplify-me.c   (revision 234705)
+++ gcc/gimplify-me.c   (working copy)
@@ -299,7 +299,8 @@ gimple_regimplify_operands (gimple *stmt
          if (need_temp)
            {
              tree temp = create_tmp_reg (TREE_TYPE (lhs));
-             if (gimple_in_ssa_p (cfun))
+             if (gimple_in_ssa_p (cfun)
+                 && is_gimple_reg_type (TREE_TYPE (lhs)))
                temp = make_ssa_name (temp);
              gimple_set_lhs (stmt, temp);
              post_stmt = gimple_build_assign (lhs, temp);

Reply via email to