This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: IPA merge: Make salias work after SSA form was built
> Okay, but:
Hi,
thank you for review! Unfortunately I found that it still fails on
verify_ssa on some pass orders on IPA-SSA. The problem is that we still
cache values in addresses_taken bitmap and trust them to be up to date.
This didn't reproduced in my original testing just because I had my
experimental "kill unnecesary datastructures" pass just before the
salias so the bitmaps was all clear at that point. I don't intend to
submit that pass for mainline, it is basically just an experiment to see
how much memory we waste by caching things, so I would like to fix this
problem too.
Amusingly I didn't found any way to rebuild this bitmap after modifying
statement since tree-ssa-operand just compute it, but never clear the old
values. Perhaps there is some way to recompute it correctly but at least it
is what I would expect update_stmt to do, so I updated build_ssa_operands
accordingly.
Bootstrapped/regtested i686-linux
OK? (and sorry for duplicated submision)
Honza
* tree-ssa-alias.c (create_structure_vars): When in SSA, update operand
caches.
* tree-ssa-operands.c (build_ssa_operands): Recompute addresses_taken
bitmap.
Index: tree-ssa-alias.c
===================================================================
*** tree-ssa-alias.c (revision 120243)
--- tree-ssa-alias.c (working copy)
*************** create_structure_vars (void)
*** 3188,3193 ****
--- 3188,3245 ----
}
htab_delete (used_portions);
VEC_free (tree, heap, varvec);
+
+ /* Update SSA operands of statememnts mentioning varibales we split. */
+ if (gimple_in_ssa_p (cfun))
+ FOR_EACH_BB (bb)
+ {
+ block_stmt_iterator bsi;
+ for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ {
+ tree stmt = bsi_stmt (bsi);
+ bool update = false;
+ unsigned int i;
+ bitmap_iterator bi;
+
+ if (STORED_SYMS (stmt))
+ EXECUTE_IF_SET_IN_BITMAP (STORED_SYMS (stmt), 0, i, bi)
+ {
+ tree sym = referenced_var_lookup (i);
+ if (get_subvars_for_var (sym))
+ {
+ update=true;
+ break;
+ }
+ }
+
+ if (LOADED_SYMS (stmt) && !update)
+ EXECUTE_IF_SET_IN_BITMAP (LOADED_SYMS (stmt), 0, i, bi)
+ {
+ tree sym = referenced_var_lookup (i);
+ if (get_subvars_for_var (sym))
+ {
+ update=true;
+ break;
+ }
+ }
+
+ if (stmt_ann (stmt)->addresses_taken && !update)
+ EXECUTE_IF_SET_IN_BITMAP (stmt_ann (stmt)->addresses_taken,
+ 0, i, bi)
+ {
+ tree sym = referenced_var_lookup (i);
+ if (get_subvars_for_var (sym))
+ {
+ update=true;
+ break;
+ }
+ }
+
+ if (update)
+ update_stmt (stmt);
+ }
+ }
+
return 0;
}
Index: tree-ssa-operands.c
===================================================================
*** tree-ssa-operands.c (revision 120243)
--- tree-ssa-operands.c (working copy)
*************** build_ssa_operands (tree stmt)
*** 2337,2342 ****
--- 2337,2345 ----
makes no memory references. */
ann->has_volatile_ops = false;
ann->references_memory = false;
+ /* Just clear the bitmap so we don't end up reallocating it over and over. */
+ if (ann->addresses_taken)
+ bitmap_clear (ann->addresses_taken);
start_ssa_stmt_operands ();
parse_ssa_operands (stmt);
*************** build_ssa_operands (tree stmt)
*** 2344,2349 ****
--- 2347,2354 ----
operand_build_sort_virtual (build_vdefs);
finalize_ssa_stmt_operands (stmt);
+ if (ann->addresses_taken && bitmap_empty_p (ann->addresses_taken))
+ ann->addresses_taken = NULL;
/* For added safety, assume that statements with volatile operands
also reference memory. */
if (ann->has_volatile_ops)