optimize.c (expand_call_inline): Don't recurse into the code used to initialize the parameters more than once.
* optimize.c (expand_call_inline): Don't recurse into the code used to initialize the parameters more than once. From-SVN: r34501
This commit is contained in:
parent
f6f8291af0
commit
071f9809f9
@ -1,3 +1,8 @@
|
||||
2000-06-12 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* optimize.c (expand_call_inline): Don't recurse into the code
|
||||
used to initialize the parameters more than once.
|
||||
|
||||
2000-06-11 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* mangle.c (NESTED_TEMPLATE_MATCH): Fix typo in comment.
|
||||
|
@ -612,6 +612,7 @@ expand_call_inline (tp, walk_subtrees, data)
|
||||
tree scope_stmt;
|
||||
tree use_stmt;
|
||||
tree arg_inits;
|
||||
tree *inlined_body;
|
||||
splay_tree st;
|
||||
|
||||
/* See what we've got. */
|
||||
@ -724,8 +725,10 @@ expand_call_inline (tp, walk_subtrees, data)
|
||||
|
||||
/* After we've initialized the parameters, we insert the body of the
|
||||
function itself. */
|
||||
STMT_EXPR_STMT (expr)
|
||||
= chainon (STMT_EXPR_STMT (expr), copy_body (id));
|
||||
inlined_body = &STMT_EXPR_STMT (expr);
|
||||
while (*inlined_body)
|
||||
inlined_body = &TREE_CHAIN (*inlined_body);
|
||||
*inlined_body = copy_body (id);
|
||||
|
||||
/* Close the block for the parameters. */
|
||||
scope_stmt = build_min_nt (SCOPE_STMT, DECL_INITIAL (fn));
|
||||
@ -771,7 +774,7 @@ expand_call_inline (tp, walk_subtrees, data)
|
||||
TREE_USED (*tp) = 1;
|
||||
|
||||
/* Recurse into the body of the just inlined function. */
|
||||
expand_calls_inline (tp, id);
|
||||
expand_calls_inline (inlined_body, id);
|
||||
VARRAY_POP (id->fns);
|
||||
|
||||
/* Don't walk into subtrees. We've already handled them above. */
|
||||
|
33
gcc/testsuite/g++.old-deja/g++.other/inline11.C
Normal file
33
gcc/testsuite/g++.old-deja/g++.other/inline11.C
Normal file
@ -0,0 +1,33 @@
|
||||
// Origin: Jakub Jelinek <jakub@redhat.com>
|
||||
// Special g++ Options: -O2
|
||||
|
||||
class baz
|
||||
{
|
||||
public:
|
||||
baz& operator += (const baz&);
|
||||
};
|
||||
|
||||
inline baz& baz::operator += (const baz& r)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline baz operator + (int x, const baz& y)
|
||||
{
|
||||
return y;
|
||||
}
|
||||
|
||||
static inline baz bar (int alpha);
|
||||
static inline baz foo (int alpha)
|
||||
{
|
||||
baz tmp = alpha + foo (alpha);
|
||||
tmp += alpha + bar (alpha);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static inline baz bar (int alpha)
|
||||
{
|
||||
baz tmp = alpha + bar (alpha);
|
||||
tmp += alpha + foo (alpha);
|
||||
return tmp;
|
||||
}
|
Loading…
Reference in New Issue
Block a user