summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@138bc75d-0d04-0410-961f-82ee72b054a4>2012-08-03 14:43:09 +0000
committermatz <matz@138bc75d-0d04-0410-961f-82ee72b054a4>2012-08-03 14:43:09 +0000
commit99fade12b53ba208ba3354b45e2953a01ba44b23 (patch)
tree0acd6e083bdf5f15806c19d466acea6b8e12926a
parent4f5712bd2b23b68ba510f4ed99018df2a7c5fb93 (diff)
downloadgcc-99fade12b53ba208ba3354b45e2953a01ba44b23.tar.gz
PR tree-optimization/54146
* cfgexpand.c (add_scope_conflicts_1): Use bitmap_ior_into. (add_scope_conflicts): Iterate in RPO order. (add_stack_protection_conflicts): Iterate over the other triangle. (fini_vars_expansion): Clear stack_vars_sorted. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190126 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/cfgexpand.c24
2 files changed, 26 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a8923b3885a..193c2d3b5b1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,4 +1,12 @@
-2012-08-03 Marc Glisse <marc.glisse@inria.fr>
+2012-08-03 Michael Matz <matz@suse.de>
+
+ PR tree-optimization/54146
+ * cfgexpand.c (add_scope_conflicts_1): Use bitmap_ior_into.
+ (add_scope_conflicts): Iterate in RPO order.
+ (add_stack_protection_conflicts): Iterate over the other triangle.
+ (fini_vars_expansion): Clear stack_vars_sorted.
+
+2012-08-03 Marc Glisse <marc.glisse@inria.fr>
PR tree-optimization/30318
* double-int.c (mul_double_wide_with_sign): New function.
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index e5e26e368a2..9bf6af64224 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -429,10 +429,10 @@ add_scope_conflicts_1 (basic_block bb, bitmap work, bool for_conflict)
unsigned i;
EXECUTE_IF_SET_IN_BITMAP (work, 0, i, bi)
{
- unsigned j;
- bitmap_iterator bj;
- EXECUTE_IF_SET_IN_BITMAP (work, i + 1, j, bj)
- add_stack_var_conflict (i, j);
+ struct stack_var *a = &stack_vars[i];
+ if (!a->conflicts)
+ a->conflicts = BITMAP_ALLOC (NULL);
+ bitmap_ior_into (a->conflicts, work);
}
visit = visit_conflict;
}
@@ -450,6 +450,8 @@ add_scope_conflicts (void)
basic_block bb;
bool changed;
bitmap work = BITMAP_ALLOC (NULL);
+ int *rpo;
+ int n_bbs;
/* We approximate the live range of a stack variable by taking the first
mention of its name as starting point(s), and by the end-of-scope
@@ -464,13 +466,19 @@ add_scope_conflicts (void)
FOR_ALL_BB (bb)
bb->aux = BITMAP_ALLOC (NULL);
+ rpo = XNEWVEC (int, last_basic_block);
+ n_bbs = pre_and_rev_post_order_compute (NULL, rpo, false);
+
changed = true;
while (changed)
{
+ int i;
changed = false;
- FOR_EACH_BB (bb)
+ for (i = 0; i < n_bbs; i++)
{
- bitmap active = (bitmap)bb->aux;
+ bitmap active;
+ bb = BASIC_BLOCK (rpo[i]);
+ active = (bitmap)bb->aux;
add_scope_conflicts_1 (bb, work, false);
if (bitmap_ior_into (active, work))
changed = true;
@@ -480,6 +488,7 @@ add_scope_conflicts (void)
FOR_EACH_BB (bb)
add_scope_conflicts_1 (bb, work, true);
+ free (rpo);
BITMAP_FREE (work);
FOR_ALL_BB (bb)
BITMAP_FREE (bb->aux);
@@ -1344,7 +1353,7 @@ add_stack_protection_conflicts (void)
for (i = 0; i < n; ++i)
{
unsigned char ph_i = phase[i];
- for (j = 0; j < i; ++j)
+ for (j = i + 1; j < n; ++j)
if (ph_i != phase[j])
add_stack_var_conflict (i, j);
}
@@ -1393,6 +1402,7 @@ fini_vars_expansion (void)
XDELETEVEC (stack_vars);
XDELETEVEC (stack_vars_sorted);
stack_vars = NULL;
+ stack_vars_sorted = NULL;
stack_vars_alloc = stack_vars_num = 0;
pointer_map_destroy (decl_to_stack_part);
decl_to_stack_part = NULL;