aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/optimize.c17
2 files changed, 13 insertions, 9 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 96ad5bd..d482875 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+Fri Feb 25 14:52:33 2000 Jim Wilson <wilson@cygnus.com>
+
+ * optimize.c (expand_call_inline): Emit the return label before
+ evaluating the return value.
+
2000-02-24 Mark Mitchell <mark@codesourcery.com>
* lex.c (check_newline): Use push_srcloc and pop_srcloc, rather
diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c
index e18f956..f5db6a1 100644
--- a/gcc/cp/optimize.c
+++ b/gcc/cp/optimize.c
@@ -39,11 +39,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
are not needed.
o Provide heuristics to clamp inlining of recursive template
- calls?
+ calls? */
- o It looks like the return label is not being placed in the optimal
- place. Shouldn't it come before the returned value? */
-
/* Data required for function inlining. */
typedef struct inline_data
@@ -644,6 +641,13 @@ expand_call_inline (tp, walk_subtrees, data)
STMT_EXPR_STMT (expr)
= chainon (STMT_EXPR_STMT (expr), scope_stmt);
+ /* After the body of the function comes the RET_LABEL. This must come
+ before we evaluate the returned value below, because that evalulation
+ may cause RTL to be generated. */
+ STMT_EXPR_STMT (expr)
+ = chainon (STMT_EXPR_STMT (expr),
+ build_min_nt (LABEL_STMT, id->ret_label));
+
/* Finally, mention the returned value so that the value of the
statement-expression is the returned value of the function. */
STMT_EXPR_STMT (expr) = chainon (STMT_EXPR_STMT (expr), use_stmt);
@@ -652,11 +656,6 @@ expand_call_inline (tp, walk_subtrees, data)
splay_tree_delete (id->decl_map);
id->decl_map = st;
- /* After the body of the function comes the RET_LABEL. */
- STMT_EXPR_STMT (expr)
- = chainon (STMT_EXPR_STMT (expr),
- build_min_nt (LABEL_STMT, id->ret_label));
-
/* The new expression has side-effects if the old one did. */
TREE_SIDE_EFFECTS (expr) = TREE_SIDE_EFFECTS (t);