[C++ PATCH] Fix inlined_stmts computation for inline throttling
Jakub Jelinek
jakub@redhat.com
Tue Apr 3 05:01:00 GMT 2001
Hi!
The computation of inlined_stmts looks wrong to me:
firstly DECL_NUM_STMTS of the to-be-inlined function is correctly accounted
to the function being expanded, but then the total number of statements in
the function being expanded is added to inlined_stmts. This means the
function being expanded plus gradually all the successful inlines will be
accounted many times. Say if
void bar () { ... }
void baz () { ... }
void foo () { bar (); baz (); ... }
these functions have initially 30, 40, 20 statements, then at the point of
expanding bar inlined_stmts will be bumped from 0 to 50 and when expanding
baz inlined_stmts will be bumped up to 140 (but it should be 70 at that
point).
2001-04-03 Jakub Jelinek <jakub@redhat.com>
* optimize.c (expand_call_inline): Only add newly inlined statements
into inlined_stmts.
--- gcc/cp/optimize.c.jj Fri Mar 30 11:44:59 2001
+++ gcc/cp/optimize.c Tue Apr 3 14:50:40 2001
@@ -862,7 +862,7 @@ expand_call_inline (tp, walk_subtrees, d
/* Our function now has more statements than it did before. */
DECL_NUM_STMTS (VARRAY_TREE (id->fns, 0)) += DECL_NUM_STMTS (fn);
- id->inlined_stmts += DECL_NUM_STMTS (VARRAY_TREE (id->fns, 0));
+ id->inlined_stmts += DECL_NUM_STMTS (fn);
/* Recurse into the body of the just inlined function. */
expand_calls_inline (inlined_body, id);
Jakub
More information about the Gcc-patches
mailing list