This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR37328, wrong gimple from SRA


The fix is to re-gimplify the possibly inserted conversion.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2008-09-03  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/37328
	* tree-sra.c (sra_build_assignment): Gimplify properly.
	(generate_copy_inout): Take the correct stmt as definition,
	remove bogus assert.

Index: gcc/tree-sra.c
===================================================================
*** gcc/tree-sra.c	(revision 139889)
--- gcc/tree-sra.c	(working copy)
*************** static gimple_seq
*** 2144,2150 ****
  sra_build_assignment (tree dst, tree src)
  {
    gimple stmt;
!   gimple_seq seq = NULL;
    /* Turning BIT_FIELD_REFs into bit operations enables other passes
       to do a much better job at optimizing the code.
       From dst = BIT_FIELD_REF <var, sz, off> we produce
--- 2144,2150 ----
  sra_build_assignment (tree dst, tree src)
  {
    gimple stmt;
!   gimple_seq seq = NULL, seq2 = NULL;
    /* Turning BIT_FIELD_REFs into bit operations enables other passes
       to do a much better job at optimizing the code.
       From dst = BIT_FIELD_REF <var, sz, off> we produce
*************** sra_build_assignment (tree dst, tree src
*** 2308,2313 ****
--- 2308,2315 ----
  	   && !useless_type_conversion_p (TREE_TYPE (dst), TREE_TYPE (src)))
      src = fold_convert (TREE_TYPE (dst), src);
  
+   src = force_gimple_operand (src, &seq2, false, NULL_TREE);
+   gimple_seq_add_seq (&seq, seq2);
    stmt = gimple_build_assign (dst, src);
    gimple_seq_add_stmt (&seq, stmt);
    return seq;
*************** generate_copy_inout (struct sra_elt *elt
*** 2597,2604 ****
  
        t = build2 (COMPLEX_EXPR, elt->type, r, i);
        tmp_seq = sra_build_bf_assignment (expr, t);
!       gcc_assert (gimple_seq_singleton_p (tmp_seq));
!       SSA_NAME_DEF_STMT (expr) = gimple_seq_first_stmt (tmp_seq);
        gimple_seq_add_seq (seq_p, tmp_seq);
      }
    else if (elt->replacement)
--- 2599,2605 ----
  
        t = build2 (COMPLEX_EXPR, elt->type, r, i);
        tmp_seq = sra_build_bf_assignment (expr, t);
!       SSA_NAME_DEF_STMT (expr) = gimple_seq_last_stmt (tmp_seq);
        gimple_seq_add_seq (seq_p, tmp_seq);
      }
    else if (elt->replacement)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]