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 PR35411, SRA creates non-gimple assignments


of the form

  tmp4.field = (<unnamed-signed:53>) SR.447_374;

which confuses SCCVN later.  Fixed thusly.

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

Richard.

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

	PR tree-optimization/35411
	* tree-sra.c (sra_build_assignment): Split conversion to
	final type to a separate statement if we are not assigning
	to a register.

Index: tree-sra.c
===================================================================
*** tree-sra.c	(revision 132767)
--- tree-sra.c	(working copy)
*************** sra_build_assignment (tree dst, tree src
*** 2139,2145 ****
    if (scalar_bitfield_p (src))
      {
        tree var, shift, width;
!       tree utype, stype, stmp, utmp;
        tree list, stmt;
        bool unsignedp = BIT_FIELD_REF_UNSIGNED (src);
  
--- 2139,2145 ----
    if (scalar_bitfield_p (src))
      {
        tree var, shift, width;
!       tree utype, stype, stmp, utmp, dtmp;
        tree list, stmt;
        bool unsignedp = BIT_FIELD_REF_UNSIGNED (src);
  
*************** sra_build_assignment (tree dst, tree src
*** 2256,2261 ****
--- 2256,2271 ----
  	    var = fold_convert (TREE_TYPE (dst), var);
  	  else
  	    var = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (dst), var);
+ 
+ 	  /* If the destination is not a register the conversion needs
+ 	     to be a separate statement.  */
+ 	  if (!is_gimple_reg (dst))
+ 	    {
+ 	      dtmp = make_rename_temp (TREE_TYPE (dst), "SR");
+ 	      stmt = build_gimple_modify_stmt (dtmp, var);
+ 	      append_to_statement_list (stmt, &list);
+ 	      var = dtmp;
+ 	    }
  	}
        stmt = build_gimple_modify_stmt (dst, var);
        append_to_statement_list (stmt, &list);


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