public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/18499] New: [4.0 Regression] quadratic behavior in cfgexpand
@ 2004-11-15 10:26 steven at gcc dot gnu dot org
2004-11-15 10:34 ` [Bug middle-end/18499] " steven at gcc dot gnu dot org
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-11-15 10:26 UTC (permalink / raw)
To: gcc-bugs
The test case for 17340 exposes quadratic behavior caused by
abnormal edges in the CFG:
% cumulative self self total
time seconds seconds calls s/call s/call name
13.83 36.60 37.60 272892 0.00 0.00 remove_edge
4.90 50.92 13.32 17634463 0.00 0.00 replace_goto_queue_1
2.18 56.84 5.92 443335 0.00 0.00 find_reloads
1.93 62.08 5.24 1110938 0.00 0.00 gt_ggc_mx_lang_tree_node
1.76 66.87 4.79 375356 0.00 0.00 record_reg_classes
1.39 70.65 3.78 13455581 0.00 0.00 ggc_set_mark
1.37 74.37 3.72 8683135 0.00 0.00 ggc_alloc_stat
1.26 77.81 3.44 3448355 0.00 0.00 comptypes
1.21 81.09 3.28 1336950 0.00 0.00 walk_tree
-----------------------------------------------
0.11 0.00 919/272892 purge_dead_edges [270]
0.37 0.00 3133/272892 delete_basic_block [160]
1.08 0.00 9094/272892
remove_phi_nodes_and_edges_for_unreachable_block [234]
1.10 0.00 9303/272892 remove_fake_predecessors
[229]
2.06 0.01 17341/272892 merge_blocks [139]
2.61 0.01 21999/272892 find_bb_boundaries [100]
3.84 0.02 32405/272892 connect_post_landing_pads
[78]
9.66 0.04 81428/272892 finish_eh_generation [31]
16.77 0.00 97270/272892 expand_gimple_basic_block
[17]
[30] 13.9 37.60 0.08 272892 remove_edge [30]
0.08 0.00 272892/523547 ggc_free [613]
0.00 0.00 272892/341925 free_edge [2842]
-----------------------------------------------
This comes from this loop:
for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
{
/* Clear EDGE_EXECUTABLE. This flag is never used in the backend. */
e->flags &= ~EDGE_EXECUTABLE;
/* At the moment not all abnormal edges match the RTL representation.
It is safe to remove them here as find_sub_basic_blocks will
rediscover them. In the future we should get this fixed properly.
*/
if (e->flags & EDGE_ABNORMAL)
remove_edge (ei);
else
ei_next (&ei);
}
We walk all edges here, and we walk all of them again for remove_edge.
--
Summary: [4.0 Regression] quadratic behavior in cfgexpand
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Keywords: compile-time-hog
Severity: normal
Priority: P2
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: steven at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org,jh at suse dot cz
BugsThisDependsOn: 17340
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18499
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/18499] [4.0 Regression] quadratic behavior in cfgexpand
2004-11-15 10:26 [Bug middle-end/18499] New: [4.0 Regression] quadratic behavior in cfgexpand steven at gcc dot gnu dot org
@ 2004-11-15 10:34 ` steven at gcc dot gnu dot org
2004-11-15 10:37 ` jh at suse dot cz
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-11-15 10:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From steven at gcc dot gnu dot org 2004-11-15 10:34 -------
Perhaps we should have an edge flag to mark edges dead, then walk the
entire CFG visiting all succ edges once (marking the dead ones) and
have a function remove_many_edges() in cfg.c to kill marked edges...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18499
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/18499] [4.0 Regression] quadratic behavior in cfgexpand
2004-11-15 10:26 [Bug middle-end/18499] New: [4.0 Regression] quadratic behavior in cfgexpand steven at gcc dot gnu dot org
2004-11-15 10:34 ` [Bug middle-end/18499] " steven at gcc dot gnu dot org
@ 2004-11-15 10:37 ` jh at suse dot cz
2004-11-15 10:41 ` stevenb at suse dot de
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jh at suse dot cz @ 2004-11-15 10:37 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jh at suse dot cz 2004-11-15 10:37 -------
Subject: Re: New: [4.0 Regression] quadratic behavior in cfgexpand
> The test case for 17340 exposes quadratic behavior caused by
> abnormal edges in the CFG:
>
>
> % cumulative self self total
> time seconds seconds calls s/call s/call name
> 13.83 36.60 37.60 272892 0.00 0.00 remove_edge
> 4.90 50.92 13.32 17634463 0.00 0.00 replace_goto_queue_1
> 2.18 56.84 5.92 443335 0.00 0.00 find_reloads
> 1.93 62.08 5.24 1110938 0.00 0.00 gt_ggc_mx_lang_tree_node
> 1.76 66.87 4.79 375356 0.00 0.00 record_reg_classes
> 1.39 70.65 3.78 13455581 0.00 0.00 ggc_set_mark
> 1.37 74.37 3.72 8683135 0.00 0.00 ggc_alloc_stat
> 1.26 77.81 3.44 3448355 0.00 0.00 comptypes
> 1.21 81.09 3.28 1336950 0.00 0.00 walk_tree
>
> -----------------------------------------------
> 0.11 0.00 919/272892 purge_dead_edges [270]
> 0.37 0.00 3133/272892 delete_basic_block [160]
> 1.08 0.00 9094/272892
> remove_phi_nodes_and_edges_for_unreachable_block [234]
> 1.10 0.00 9303/272892 remove_fake_predecessors
> [229]
> 2.06 0.01 17341/272892 merge_blocks [139]
> 2.61 0.01 21999/272892 find_bb_boundaries [100]
> 3.84 0.02 32405/272892 connect_post_landing_pads
> [78]
> 9.66 0.04 81428/272892 finish_eh_generation [31]
> 16.77 0.00 97270/272892 expand_gimple_basic_block
> [17]
> [30] 13.9 37.60 0.08 272892 remove_edge [30]
> 0.08 0.00 272892/523547 ggc_free [613]
> 0.00 0.00 272892/341925 free_edge [2842]
> -----------------------------------------------
>
> This comes from this loop:
>
> for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
> {
> /* Clear EDGE_EXECUTABLE. This flag is never used in the backend. */
> e->flags &= ~EDGE_EXECUTABLE;
>
> /* At the moment not all abnormal edges match the RTL representation.
> It is safe to remove them here as find_sub_basic_blocks will
> rediscover them. In the future we should get this fixed properly.
> */
> if (e->flags & EDGE_ABNORMAL)
> remove_edge (ei);
> else
> ei_next (&ei);
> }
>
> We walk all edges here, and we walk all of them again for remove_edge.
Hmm, this was introduced by the edge vectors change. What is the
canonical way to walk the edges and remove some?
Honza
>
> --
> Summary: [4.0 Regression] quadratic behavior in cfgexpand
> Product: gcc
> Version: 4.0.0
> Status: UNCONFIRMED
> Keywords: compile-time-hog
> Severity: normal
> Priority: P2
> Component: middle-end
> AssignedTo: unassigned at gcc dot gnu dot org
> ReportedBy: steven at gcc dot gnu dot org
> CC: gcc-bugs at gcc dot gnu dot org,jh at suse dot cz
> BugsThisDependsOn: 17340
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18499
>
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug, or are watching someone who is.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18499
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/18499] [4.0 Regression] quadratic behavior in cfgexpand
2004-11-15 10:26 [Bug middle-end/18499] New: [4.0 Regression] quadratic behavior in cfgexpand steven at gcc dot gnu dot org
2004-11-15 10:34 ` [Bug middle-end/18499] " steven at gcc dot gnu dot org
2004-11-15 10:37 ` jh at suse dot cz
@ 2004-11-15 10:41 ` stevenb at suse dot de
2004-11-15 11:38 ` steven at gcc dot gnu dot org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: stevenb at suse dot de @ 2004-11-15 10:41 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From stevenb at suse dot de 2004-11-15 10:41 -------
Subject: Re: [4.0 Regression] quadratic behavior in cfgexpand
Actually this has always been there, independent of the edge vector
work. The old code has exactly the same problem.
There is *no* canonical way to remove many edges. Apparently we
should have one.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18499
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/18499] [4.0 Regression] quadratic behavior in cfgexpand
2004-11-15 10:26 [Bug middle-end/18499] New: [4.0 Regression] quadratic behavior in cfgexpand steven at gcc dot gnu dot org
` (2 preceding siblings ...)
2004-11-15 10:41 ` stevenb at suse dot de
@ 2004-11-15 11:38 ` steven at gcc dot gnu dot org
2004-11-15 18:12 ` pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-11-15 11:38 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From steven at gcc dot gnu dot org 2004-11-15 11:38 -------
Created an attachment (id=7547)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7547&action=view)
Suggestion for removing many edges at once
Something like this might help. There are still a few other places I'm looking
at where we want to remove many edges.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18499
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/18499] [4.0 Regression] quadratic behavior in cfgexpand
2004-11-15 10:26 [Bug middle-end/18499] New: [4.0 Regression] quadratic behavior in cfgexpand steven at gcc dot gnu dot org
` (3 preceding siblings ...)
2004-11-15 11:38 ` steven at gcc dot gnu dot org
@ 2004-11-15 18:12 ` pinskia at gcc dot gnu dot org
2004-11-15 19:25 ` giovannibajo at libero dot it
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-15 18:12 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-11-15 18:12 -------
confirmed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-11-15 18:12:19
date| |
Target Milestone|--- |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18499
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/18499] [4.0 Regression] quadratic behavior in cfgexpand
2004-11-15 10:26 [Bug middle-end/18499] New: [4.0 Regression] quadratic behavior in cfgexpand steven at gcc dot gnu dot org
` (4 preceding siblings ...)
2004-11-15 18:12 ` pinskia at gcc dot gnu dot org
@ 2004-11-15 19:25 ` giovannibajo at libero dot it
2004-11-15 19:31 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: giovannibajo at libero dot it @ 2004-11-15 19:25 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-11-15 19:25 -------
Doesn't the quadraticy come from VEC_unordered_remove? If you have M total
edges and you want to remove N of them, the complexity is O(N*M) with vectors,
but used to be O(N) with lists.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18499
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/18499] [4.0 Regression] quadratic behavior in cfgexpand
2004-11-15 10:26 [Bug middle-end/18499] New: [4.0 Regression] quadratic behavior in cfgexpand steven at gcc dot gnu dot org
` (6 preceding siblings ...)
2004-11-15 19:31 ` pinskia at gcc dot gnu dot org
@ 2004-11-15 19:31 ` stevenb at suse dot de
2004-11-24 11:12 ` steven at gcc dot gnu dot org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: stevenb at suse dot de @ 2004-11-15 19:31 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From stevenb at suse dot de 2004-11-15 19:31 -------
Subject: Re: [4.0 Regression] quadratic behavior in cfgexpand
The complexity is O(N) with vectors and with lists. How on earth
do you get to O(N*M)?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18499
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/18499] [4.0 Regression] quadratic behavior in cfgexpand
2004-11-15 10:26 [Bug middle-end/18499] New: [4.0 Regression] quadratic behavior in cfgexpand steven at gcc dot gnu dot org
` (5 preceding siblings ...)
2004-11-15 19:25 ` giovannibajo at libero dot it
@ 2004-11-15 19:31 ` pinskia at gcc dot gnu dot org
2004-11-15 19:31 ` stevenb at suse dot de
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-15 19:31 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-11-15 19:30 -------
No they come from that fact remove_edge is O(number of edges in succ of BB)+O(number of edges in
pred of BB) and then you are doing O(number of edges) with calling remove_edge the whole thing now
becomes O(n^2).
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18499
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/18499] [4.0 Regression] quadratic behavior in cfgexpand
2004-11-15 10:26 [Bug middle-end/18499] New: [4.0 Regression] quadratic behavior in cfgexpand steven at gcc dot gnu dot org
` (7 preceding siblings ...)
2004-11-15 19:31 ` stevenb at suse dot de
@ 2004-11-24 11:12 ` steven at gcc dot gnu dot org
2004-12-07 9:16 ` steven at gcc dot gnu dot org
2004-12-15 18:57 ` steven at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-11-24 11:12 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From steven at gcc dot gnu dot org 2004-11-24 11:12 -------
(From update of attachment 7547)
The problem was searching edges the edge->dest block in remove_edge,
but we now have dest_idx on for edge (thanks to Kazu's O(1) PHI arg
lookup patches) so we don't have to search the dest block anymore.
So I suspect at least the part of the problem that put remove_edge
high up in the profile is now fixed, and my patch is obsolete. I'll
reprofile and see what else we can do to speed up this test case...
--
What |Removed |Added
----------------------------------------------------------------------------
Attachment #7547 is|0 |1
obsolete| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18499
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/18499] [4.0 Regression] quadratic behavior in cfgexpand
2004-11-15 10:26 [Bug middle-end/18499] New: [4.0 Regression] quadratic behavior in cfgexpand steven at gcc dot gnu dot org
` (8 preceding siblings ...)
2004-11-24 11:12 ` steven at gcc dot gnu dot org
@ 2004-12-07 9:16 ` steven at gcc dot gnu dot org
2004-12-15 18:57 ` steven at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-12-07 9:16 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From steven at gcc dot gnu dot org 2004-12-07 09:15 -------
Fixed:
Counted GLOBAL_POWER_EVENTS events (time during which processor is not
stopped) with a unit mask of 0x01 (mandatory) count 100000
samples % symbol name
63499 4.4898 replace_goto_queue_stmt_list
40791 2.8842 ggc_alloc_stat
39075 2.7629 find_reloads
38041 2.6898 record_reg_classes
25783 1.8230 ggc_set_mark
22879 1.6177 walk_tree
22876 1.6175 gt_ggc_mx_lang_tree_node
19695 1.3926 mark_set_1
17427 1.2322 comptypes
14800 1.0465 htab_find_with_hash
Execution times (seconds)
garbage collection : 0.58 ( 4%) usr 0.01 ( 1%) sys 0.59 ( 4%) wall
callgraph construction: 0.20 ( 1%) usr 0.03 ( 2%) sys 0.23 ( 1%) wall
callgraph optimization: 0.00 ( 0%) usr 0.00 ( 0%) sys 0.01 ( 0%) wall
cfg cleanup : 0.28 ( 2%) usr 0.00 ( 0%) sys 0.31 ( 2%) wall
trivially dead code : 0.05 ( 0%) usr 0.00 ( 0%) sys 0.05 ( 0%) wall
life analysis : 0.45 ( 3%) usr 0.01 ( 1%) sys 0.43 ( 3%) wall
life info update : 0.20 ( 1%) usr 0.00 ( 0%) sys 0.22 ( 1%) wall
register scan : 0.05 ( 0%) usr 0.00 ( 0%) sys 0.05 ( 0%) wall
rebuild jump labels : 0.06 ( 0%) usr 0.00 ( 0%) sys 0.11 ( 1%) wall
preprocessing : 0.12 ( 1%) usr 0.13 ( 7%) sys 0.27 ( 2%) wall
parser : 3.55 (25%) usr 0.53 (29%) sys 3.88 (24%) wall
name lookup : 0.88 ( 6%) usr 0.75 (41%) sys 1.60 (10%) wall
tree gimplify : 0.63 ( 4%) usr 0.02 ( 1%) sys 0.80 ( 5%) wall
tree eh : 0.89 ( 6%) usr 0.02 ( 1%) sys 0.93 ( 6%) wall
tree CFG construction : 0.24 ( 2%) usr 0.04 ( 2%) sys 0.27 ( 2%) wall
tree CFG cleanup : 0.05 ( 0%) usr 0.00 ( 0%) sys 0.08 ( 1%) wall
expand : 1.19 ( 8%) usr 0.04 ( 2%) sys 1.14 ( 7%) wall
varconst : 0.11 ( 1%) usr 0.02 ( 1%) sys 0.15 ( 1%) wall
jump : 0.42 ( 3%) usr 0.02 ( 1%) sys 0.40 ( 3%) wall
flow analysis : 0.10 ( 1%) usr 0.00 ( 0%) sys 0.11 ( 1%) wall
local alloc : 0.76 ( 5%) usr 0.00 ( 0%) sys 0.78 ( 5%) wall
global alloc : 1.59 (11%) usr 0.08 ( 4%) sys 1.68 (11%) wall
flow 2 : 0.33 ( 2%) usr 0.00 ( 0%) sys 0.31 ( 2%) wall
shorten branches : 0.28 ( 2%) usr 0.00 ( 0%) sys 0.25 ( 2%) wall
final : 0.59 ( 4%) usr 0.11 ( 6%) sys 0.80 ( 5%) wall
symout : 0.03 ( 0%) usr 0.01 ( 1%) sys 0.03 ( 0%) wall
rest of compilation : 0.50 ( 4%) usr 0.00 ( 0%) sys 0.46 ( 3%) wall
TOTAL : 14.14 1.82 15.97
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18499
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/18499] [4.0 Regression] quadratic behavior in cfgexpand
2004-11-15 10:26 [Bug middle-end/18499] New: [4.0 Regression] quadratic behavior in cfgexpand steven at gcc dot gnu dot org
` (9 preceding siblings ...)
2004-12-07 9:16 ` steven at gcc dot gnu dot org
@ 2004-12-15 18:57 ` steven at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-12-15 18:57 UTC (permalink / raw)
To: gcc-bugs
--
Bug 18499 depends on bug 17340, which changed state.
Bug 17340 Summary: [4.0 Regression] Internal error compiling with -O3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17340
What |Old Value |New Value
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18499
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2004-12-15 18:57 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-15 10:26 [Bug middle-end/18499] New: [4.0 Regression] quadratic behavior in cfgexpand steven at gcc dot gnu dot org
2004-11-15 10:34 ` [Bug middle-end/18499] " steven at gcc dot gnu dot org
2004-11-15 10:37 ` jh at suse dot cz
2004-11-15 10:41 ` stevenb at suse dot de
2004-11-15 11:38 ` steven at gcc dot gnu dot org
2004-11-15 18:12 ` pinskia at gcc dot gnu dot org
2004-11-15 19:25 ` giovannibajo at libero dot it
2004-11-15 19:31 ` pinskia at gcc dot gnu dot org
2004-11-15 19:31 ` stevenb at suse dot de
2004-11-24 11:12 ` steven at gcc dot gnu dot org
2004-12-07 9:16 ` steven at gcc dot gnu dot org
2004-12-15 18:57 ` steven at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).