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]

Re: [PATCH] Fix SRA and initializers



On Dec 28, 2004, at 8:36 PM, Richard Henderson wrote:


On Wed, Dec 22, 2004 at 04:24:51PM -0500, Andrew Pinski wrote:
+  other = force_gimple_operand (init, &stmts, false, var);
+  stmt = build (MODIFY_EXPR, void_type_node, var, other);

You're not bothering to notice when SSA_VAR (other) = var, or what?

Yes I just noticed that. I just pass NULL_TREE instead of var to force_gimple_operand since force_gimple_operand is funny when init is already a gimple var.

+ find_new_referenced_vars (&stmts);

Which you don't need to do with force_gimple_operand.

Yes we still, since only the new temporary variables are found with force_gimple_operand and not the variables which were in init.


Here is a testcase which still needs it (Andreas Schwab
found it on ia64, but note I modified my patch to fix this
testcase also):
typedef long unsigned int size_t;
struct cbuf {
 char const *string;
 size_t size;
};
static int keepflag;
struct cbuf
getlogmsg()
{
 static char const
  emptych[] = "*** empty log message ***";
 static struct cbuf const
  emptylog = { emptych, sizeof(emptych)-sizeof(char) };
 if (keepflag) {
  return emptylog;
 }
 return emptylog;
}

OK? Bootstrapped and tested on ppc-darwin and made sure
the above testcase still passes.


Thanks, Andrew Pinski

ChangeLog:
ChangeLog:

	* tree-sra.c (generate_one_element_init): Use force_gimple_operand
	instead of gimplify_stmt.
	(scalarize_init): Do not call
	push_gimplify_context/pop_gimplify_context.


Attachment: fixSRA.diff.txt
Description: Text document



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