Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
8637b5b0
Commit
8637b5b0
authored
Oct 07, 2016
by
yb9976
Browse files
Improve GCSE heuristic
We now also consider post dominance to find SESE regions
parent
4235d21d
Changes
2
Hide whitespace changes
Inline
Side-by-side
ir/opt/irgopt.c
View file @
8637b5b0
...
...
@@ -180,6 +180,8 @@ void optimize_graph_df(ir_graph *irg)
/* any optimized nodes are stored in the wait queue,
* so if it's not empty, the graph has been changed */
while
(
!
deq_empty
(
&
waitq
))
{
assure_irg_properties
(
irg
,
IR_GRAPH_PROPERTY_CONSISTENT_POSTDOMINANCE
);
/* finish the wait queue */
while
(
!
deq_empty
(
&
waitq
))
{
ir_node
*
n
=
deq_pop_pointer_left
(
ir_node
,
&
waitq
);
...
...
ir/opt/iropt.c
View file @
8637b5b0
...
...
@@ -7726,11 +7726,19 @@ static int identities_cmp(const void *elt, const void *key)
/* The optimistic approach would be to do nothing here.
* However doing GCSE optimistically produces a lot of partially dead code which appears
* to be worse in practice than the missed opportunities.
* So we use a very conservative variant here and only CSE if
1
value dominates the
* other. */
* So we use a very conservative variant here and only CSE if
one
value dominates the
* other
or one value postdominates the common dominator
. */
if
(
!
block_dominates
(
block_a
,
block_b
)
&&
!
block_dominates
(
block_b
,
block_a
))
return
1
;
&&
!
block_dominates
(
block_b
,
block_a
))
{
if
(
get_Block_dom_depth
(
block_a
)
<
0
||
get_Block_dom_depth
(
block_b
)
<
0
)
return
1
;
ir_node
*
dom
=
ir_deepest_common_dominator
(
block_a
,
block_b
);
if
(
!
block_postdominates
(
block_a
,
dom
)
&&
!
block_postdominates
(
block_b
,
dom
))
return
1
;
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment