Commit 61025d1b by Richard Kenner Committed by Richard Kenner

gimplify.c (maybe_with_size_expr): If already have WITH_SIZE_EXPR, don't make another one.

	* gimplify.c (maybe_with_size_expr): If already have WITH_SIZE_EXPR,
	don't make another one.

From-SVN: r85249
parent ce961468
2004-07-27 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> 2004-07-27 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* gimplify.c (maybe_with_size_expr): If already have WITH_SIZE_EXPR,
don't make another one.
PR optimization/15077 PR optimization/15077
* function.h (struct function): Add field saved_static_chain_decl. * function.h (struct function): Add field saved_static_chain_decl.
Fix comment for static_chain_decl. Fix comment for static_chain_decl.
......
...@@ -1746,20 +1746,25 @@ gimplify_self_mod_expr (tree *expr_p, tree *pre_p, tree *post_p, ...@@ -1746,20 +1746,25 @@ gimplify_self_mod_expr (tree *expr_p, tree *pre_p, tree *post_p,
static void static void
maybe_with_size_expr (tree *expr_p) maybe_with_size_expr (tree *expr_p)
{ {
tree expr, type, size; tree expr = *expr_p;
tree type = TREE_TYPE (expr);
tree size;
expr = *expr_p; /* If we've already wrapped this or the type is error_mark_node, we can't do
type = TREE_TYPE (expr); anything. */
if (type == error_mark_node) if (TREE_CODE (expr) == WITH_SIZE_EXPR
|| type == error_mark_node)
return; return;
/* If the size isn't known or is a constant, we have nothing to do. */
size = TYPE_SIZE_UNIT (type); size = TYPE_SIZE_UNIT (type);
if (size && TREE_CODE (size) != INTEGER_CST) if (!size || TREE_CODE (size) == INTEGER_CST)
{ return;
size = unshare_expr (size);
size = SUBSTITUTE_PLACEHOLDER_IN_EXPR (size, expr); /* Otherwise, make a WITH_SIZE_EXPR. */
*expr_p = build2 (WITH_SIZE_EXPR, type, expr, size); size = unshare_expr (size);
} size = SUBSTITUTE_PLACEHOLDER_IN_EXPR (size, expr);
*expr_p = build2 (WITH_SIZE_EXPR, type, expr, size);
} }
/* Subroutine of gimplify_call_expr: Gimplify a single argument. */ /* Subroutine of gimplify_call_expr: Gimplify a single argument. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment