https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38474
--- Comment #85 from Richard Biener <rguenth at gcc dot gnu.org> ---
Starting new chain with statement:
D.31414 ={v} {CLOBBER};
The base object is:
&D.31414
Starting new chain with statement:
D.31415 ={v} {CLOBBER};
The base object is:
&D.31415
...
but those are all the last use of the base object so they just add up and
are never invalidated, but lengthening the m_stores_head list and thus
making terminate_all_aliasing_chains more expensive.
Jakub, were the clobbers ever supposed to _start_ a chain?
With
diff --git a/gcc/gimple-ssa-store-merging.c b/gcc/gimple-ssa-store-merging.c
index f0f4a068de5..fa9a092d544 100644
--- a/gcc/gimple-ssa-store-merging.c
+++ b/gcc/gimple-ssa-store-merging.c
@@ -5175,6 +5175,9 @@ pass_store_merging::process_store (gimple *stmt)
/* Store aliases any existing chain? */
ret |= terminate_all_aliasing_chains (NULL, stmt);
+ /* Do not start a new chain from a CLOBBER. */
+ if (gimple_clobber_p (stmt))
+ return ret;
/* Start a new chain. */
class imm_store_chain_info *new_chain
= new imm_store_chain_info (m_stores_head, base_addr);
compile-time gets down to
store merging : 1.18 ( 2%) 0.00 ( 0%) 1.18 ( 2%)
3858k ( 1%)
TOTAL : 59.84 0.57 60.43
557M
I'm checking if it has any testsuite fallout.