+2020-05-12 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/95045
+ * dbgcnt.def (lim): Add debug-counter.
+ * tree-ssa-loop-im.c: Include dbgcnt.h.
+ (find_refs_for_sm): Use lim debug counter for store motion
+ candidates.
+ (do_store_motion): Rename form store_motion. Commit edge
+ insertions...
+ (store_motion_loop): ... here.
+ (tree_ssa_lim): Adjust.
+
2020-05-11 Kelvin Nilsen <kelvin@gcc.gnu.org>
* config/rs6000/altivec.h (vec_clzm): Rename to vec_cntlzm.
#include "alias.h"
#include "builtins.h"
#include "tree-dfa.h"
+#include "dbgcnt.h"
/* TODO: Support for predicated code motion. I.e.
EXECUTE_IF_AND_COMPL_IN_BITMAP (refs, sm_executed, 0, i, bi)
{
ref = memory_accesses.refs_list[i];
- if (can_sm_ref_p (loop, ref))
+ if (can_sm_ref_p (loop, ref) && dbg_cnt (lim))
bitmap_set_bit (refs_to_sm, i);
}
}
{
find_refs_for_sm (loop, sm_executed, sm_in_loop);
if (!bitmap_empty_p (sm_in_loop))
- hoist_memory_references (loop, sm_in_loop, exits);
+ {
+ hoist_memory_references (loop, sm_in_loop, exits);
+ /* Commit edge inserts here to preserve the order of stores
+ when an exit exits multiple loops. */
+ gsi_commit_edge_inserts ();
+ }
}
exits.release ();
loops. */
static void
-store_motion (void)
+do_store_motion (void)
{
class loop *loop;
bitmap sm_executed = BITMAP_ALLOC (&lim_bitmap_obstack);
store_motion_loop (loop, sm_executed);
BITMAP_FREE (sm_executed);
- gsi_commit_edge_inserts ();
}
/* Fills ALWAYS_EXECUTED_IN information for basic blocks of LOOP, i.e.
/* Execute store motion. Force the necessary invariants to be moved
out of the loops as well. */
- store_motion ();
+ do_store_motion ();
/* Move the expressions that are expensive enough. */
todo = move_computations ();