* [Bug c++/51600] ice in estimate_local_effects
2011-12-17 18:06 [Bug c++/51600] New: ice in estimate_local_effects dcb314 at hotmail dot com
@ 2011-12-19 9:30 ` rguenth at gcc dot gnu.org
2011-12-19 14:23 ` [Bug tree-optimization/51600] [4.7 Regression] " rguenth at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-12-19 9:30 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51600
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011-12-19
Ever Confirmed|0 |1
--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-12-19 09:29:13 UTC ---
Confirmed. Reducing.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/51600] [4.7 Regression] ice in estimate_local_effects
2011-12-17 18:06 [Bug c++/51600] New: ice in estimate_local_effects dcb314 at hotmail dot com
2011-12-19 9:30 ` [Bug c++/51600] " rguenth at gcc dot gnu.org
@ 2011-12-19 14:23 ` rguenth at gcc dot gnu.org
2011-12-19 16:34 ` jamborm at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-12-19 14:23 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51600
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jamborm at gcc dot gnu.org
Component|c++ |tree-optimization
Target Milestone|--- |4.7.0
Summary|ice in |[4.7 Regression] ice in
|estimate_local_effects |estimate_local_effects
--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-12-19 13:44:41 UTC ---
template<class T> inline T min(T a, T b) { return a < b ? a : b; }
double cornerbound(double *P, double (*m)(double, double))
{
double b=m(P[0],P[3]);
return m(b,P[12]);
}
void bound(double *P, double (*m)(double, double), double b)
{
m(b,cornerbound(P,m));
}
void bounds(double fuzz, unsigned maxdepth)
{
double Px[]={};
double bx=Px[0];
bound(Px,min,bx);
}
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/51600] [4.7 Regression] ice in estimate_local_effects
2011-12-17 18:06 [Bug c++/51600] New: ice in estimate_local_effects dcb314 at hotmail dot com
2011-12-19 9:30 ` [Bug c++/51600] " rguenth at gcc dot gnu.org
2011-12-19 14:23 ` [Bug tree-optimization/51600] [4.7 Regression] " rguenth at gcc dot gnu.org
@ 2011-12-19 16:34 ` jamborm at gcc dot gnu.org
2011-12-21 10:22 ` jamborm at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jamborm at gcc dot gnu.org @ 2011-12-19 16:34 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51600
Martin Jambor <jamborm at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hubicka at gcc dot gnu.org
--- Comment #3 from Martin Jambor <jamborm at gcc dot gnu.org> 2011-12-19 16:08:28 UTC ---
Well, this means that estimate_ipcp_clone_size_and_time returns a
negative size growth estimate. The function is basically inlining
heuristics with special interface so perhaps such mishaps are to be
expected and I should take care even of negative values (PR 51362 was
about this function returning zero size growth estimates). Or are
they not, Honza?
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/51600] [4.7 Regression] ice in estimate_local_effects
2011-12-17 18:06 [Bug c++/51600] New: ice in estimate_local_effects dcb314 at hotmail dot com
` (2 preceding siblings ...)
2011-12-19 16:34 ` jamborm at gcc dot gnu.org
@ 2011-12-21 10:22 ` jamborm at gcc dot gnu.org
2012-01-04 13:46 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jamborm at gcc dot gnu.org @ 2011-12-21 10:22 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51600
Martin Jambor <jamborm at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
URL| |http://gcc.gnu.org/ml/gcc-p
| |atches/2011-12/msg01508.htm
| |l
--- Comment #4 from Martin Jambor <jamborm at gcc dot gnu.org> 2011-12-21 10:21:28 UTC ---
A workaround patch posted to the mailing list:
http://gcc.gnu.org/ml/gcc-patches/2011-12/msg01508.html
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/51600] [4.7 Regression] ice in estimate_local_effects
2011-12-17 18:06 [Bug c++/51600] New: ice in estimate_local_effects dcb314 at hotmail dot com
` (3 preceding siblings ...)
2011-12-21 10:22 ` jamborm at gcc dot gnu.org
@ 2012-01-04 13:46 ` rguenth at gcc dot gnu.org
2012-01-04 14:19 ` hubicka at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-04 13:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51600
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/51600] [4.7 Regression] ice in estimate_local_effects
2011-12-17 18:06 [Bug c++/51600] New: ice in estimate_local_effects dcb314 at hotmail dot com
` (4 preceding siblings ...)
2012-01-04 13:46 ` rguenth at gcc dot gnu.org
@ 2012-01-04 14:19 ` hubicka at gcc dot gnu.org
2012-01-04 14:59 ` hubicka at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: hubicka at gcc dot gnu.org @ 2012-01-04 14:19 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51600
--- Comment #5 from Jan Hubicka <hubicka at gcc dot gnu.org> 2012-01-04 14:18:26 UTC ---
OK, it is bug in estimate_edge_devirt_benefit that cause overall function size
to go bellow 0. I am looking into the fix.
Honza
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/51600] [4.7 Regression] ice in estimate_local_effects
2011-12-17 18:06 [Bug c++/51600] New: ice in estimate_local_effects dcb314 at hotmail dot com
` (5 preceding siblings ...)
2012-01-04 14:19 ` hubicka at gcc dot gnu.org
@ 2012-01-04 14:59 ` hubicka at gcc dot gnu.org
2012-01-06 14:24 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: hubicka at gcc dot gnu.org @ 2012-01-04 14:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51600
--- Comment #6 from Jan Hubicka <hubicka at gcc dot gnu.org> 2012-01-04 14:57:34 UTC ---
Estimate_edge_devirt_benefit seems to not make much of sense in mixing the
effects of inlining into the local size. Unforutnately we don't really have
much infrastructure for similar cases. For 4.8 I plan to add benefit metrics
that allows inline-analysis to hint inliner that the inlining is cool idea
besides the local code size/time improvements.
I am testing the following patch.
Index: ipa-inline-analysis.c
===================================================================
--- ipa-inline-analysis.c (revision 182871)
+++ ipa-inline-analysis.c (working copy)
@@ -2204,9 +2204,9 @@ estimate_edge_devirt_benefit (struct cgr
tree target;
struct cgraph_node *callee;
struct inline_summary *isummary;
- int edge_size = 0, edge_time = 0;
+ int edge_size, edge_time, time_diff, size_diff;
- if (!known_vals || !known_binfos)
+ if (!known_vals && !known_binfos)
return;
target = ipa_get_indirect_edge_target (ie, known_vals, known_binfos);
@@ -2214,10 +2214,12 @@ estimate_edge_devirt_benefit (struct cgr
return;
/* Account for difference in cost between indirect and direct calls. */
- *size -= ((eni_size_weights.indirect_call_cost - eni_size_weights.call_cost)
- * INLINE_SIZE_SCALE);
- *time -= ((eni_time_weights.indirect_call_cost - eni_time_weights.call_cost)
- * INLINE_TIME_SCALE * prob / REG_BR_PROB_BASE);
+ size_diff = ((eni_size_weights.indirect_call_cost -
eni_size_weights.call_cost)
+ * INLINE_SIZE_SCALE);
+ *size -= size_diff;
+ time_diff = ((eni_time_weights.indirect_call_cost -
eni_time_weights.call_cost)
+ * INLINE_TIME_SCALE * prob / REG_BR_PROB_BASE);
+ *time -= time_diff;
callee = cgraph_get_node (target);
if (!callee || !callee->analyzed)
@@ -2229,21 +2231,18 @@ estimate_edge_devirt_benefit (struct cgr
estimate_edge_size_and_time (ie, &edge_size, &edge_time, prob);
/* Count benefit only from functions that definitely will be inlined
- if additional context from NODE's caller were available. */
- if (edge_size >= isummary->size * INLINE_SIZE_SCALE)
+ if additional context from NODE's caller were available.
+
+ We just account overall size change by inlining. TODO:
+ we really need to add sort of benefit metrics for these kind of
+ cases. */
+ if (edge_size - size_diff >= isummary->size * INLINE_SIZE_SCALE)
{
/* Subtract size and time that we added for edge IE. */
- *size -= edge_size;
- *time -= edge_time;
+ *size -= edge_size - size_diff;
- /* Subtract benefit from inlining devirtualized call. */
- *size -= edge_size - isummary->size * INLINE_SIZE_SCALE;
- *time -= edge_time - (isummary->time * INLINE_TIME_SCALE * prob
- / REG_BR_PROB_BASE);
-
- /* TODO: estimate benefit from optimizing CALLEE's body provided
- additional context from IE call site.
- For insipiration see ipa-cp.c: devirtualization_time_bonus(). */
+ /* Account inlined call. */
+ *size += isummary->size * INLINE_SIZE_SCALE;
}
}
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/51600] [4.7 Regression] ice in estimate_local_effects
2011-12-17 18:06 [Bug c++/51600] New: ice in estimate_local_effects dcb314 at hotmail dot com
` (6 preceding siblings ...)
2012-01-04 14:59 ` hubicka at gcc dot gnu.org
@ 2012-01-06 14:24 ` jakub at gcc dot gnu.org
2012-01-08 0:17 ` hubicka at gcc dot gnu.org
2012-01-08 0:18 ` hubicka at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-06 14:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51600
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC| |jakub at gcc dot gnu.org
AssignedTo|unassigned at gcc dot |hubicka at gcc dot gnu.org
|gnu.org |
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/51600] [4.7 Regression] ice in estimate_local_effects
2011-12-17 18:06 [Bug c++/51600] New: ice in estimate_local_effects dcb314 at hotmail dot com
` (7 preceding siblings ...)
2012-01-06 14:24 ` jakub at gcc dot gnu.org
@ 2012-01-08 0:17 ` hubicka at gcc dot gnu.org
2012-01-08 0:18 ` hubicka at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: hubicka at gcc dot gnu.org @ 2012-01-08 0:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51600
Jan Hubicka <hubicka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #8 from Jan Hubicka <hubicka at gcc dot gnu.org> 2012-01-08 00:17:01 UTC ---
Fixed.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/51600] [4.7 Regression] ice in estimate_local_effects
2011-12-17 18:06 [Bug c++/51600] New: ice in estimate_local_effects dcb314 at hotmail dot com
` (8 preceding siblings ...)
2012-01-08 0:17 ` hubicka at gcc dot gnu.org
@ 2012-01-08 0:18 ` hubicka at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: hubicka at gcc dot gnu.org @ 2012-01-08 0:18 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51600
--- Comment #7 from Jan Hubicka <hubicka at gcc dot gnu.org> 2012-01-08 00:16:28 UTC ---
Author: hubicka
Date: Sun Jan 8 00:16:18 2012
New Revision: 182984
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182984
Log:
PR tree-optimization/51600
* ipa-inline-analysis.c (estimate_edge_devirt_benefit): Disable code
that benefits small functions.
Added:
trunk/gcc/testsuite/g++.dg/torture/pr51600.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/ipa-inline-analysis.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 11+ messages in thread