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]

IPA merge: Make salias work after SSA form was built


Hi,
this patch is needed in order to move salias pass after build_ssa.  With
IPA-SSA, I do not want the structure vars to be built for all functions
at once (at least not until this proves to be useful) to conserve memory
usage and also we would need to build new split vars after inlining
functions that contains structure references.  In fact one G++ PR is
fixed by moving salias pass after build_ssa in my tree.

Regtested/bootstrapped with IPA-SSA x86_64, routine bootstrap on
i686-linux and mainline is running, but since the new code is disabled
before SSA it ought to pass (I am keeping this conditional as I guess we
might later want to build SSA structure vars early and update them after
inlining or something, so this functionality seems useful)

OK?
Honza

	* tree-ssa-alias.c (create_structure_vars): When run after
	SSA is built, update operands of statements referring to split
	variables.
Index: tree-ssa-alias.c
===================================================================
*** tree-ssa-alias.c	(revision 120209)
--- tree-ssa-alias.c	(working copy)
*************** create_structure_vars (void)
*** 3188,3193 ****
--- 3188,3230 ----
      }
    htab_delete (used_portions);
    VEC_free (tree, heap, varvec);
+ 
+   /* Update SSA operands of statememnts mentioning varibales we split.  */
+   if (gimple_in_ssa_p (cfun))
+     FOR_EACH_BB (bb)
+       {
+ 	block_stmt_iterator bsi;
+ 	for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ 	  {
+ 	    tree stmt = bsi_stmt (bsi);
+ 	    bool update = false;
+ 	    unsigned int i;
+ 	    bitmap_iterator bi;
+ 	    if (STORED_SYMS (stmt))
+ 	       EXECUTE_IF_SET_IN_BITMAP (STORED_SYMS (stmt), 0, i, bi)
+ 		{
+ 		  tree sym = referenced_var_lookup (i);
+ 		  if (get_subvars_for_var (sym))
+ 		    {
+ 		      update=true;
+ 		      break;
+ 		    }
+ 		}
+ 	    if (LOADED_SYMS (stmt) && !update)
+ 	       EXECUTE_IF_SET_IN_BITMAP (LOADED_SYMS (stmt), 0, i, bi)
+ 		{
+ 		  tree sym = referenced_var_lookup (i);
+ 		  if (get_subvars_for_var (sym))
+ 		    {
+ 		      update=true;
+ 		      break;
+ 		    }
+ 		}
+ 	    if (update)
+ 	      update_stmt (stmt);
+ 	  }
+       }
+   
    return 0;
  }
  


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