Schedule another update_address_taken late

Message ID alpine.LSU.2.20.1908231242110.32458@zhemvz.fhfr.qr
State New
Headers show
  • Schedule another update_address_taken late
Related show

Commit Message

Richard Biener Aug. 23, 2019, 10:44 a.m.
As can be seen on the testcase in PR91526 the vectorizer can end
up marking things addressable because it creates very many
pointer IV.  Then unrolling can completely elide a loop or IVOPTs
can choose other IVs.  Thus it's certainly beneficial for
other passes to have an updated TREE_ADDRESSABLE, esp. NRV
which bails out on TREE_ADDRESSABLE marked vars.  Similar
tail-call wants to know this.

Not enough to fix the PR, but anyways.

Bootstrap / regtest running on x86_64-unknown-linux-gnu.


2019-08-23  Richard Biener  <>

	PR tree-optimization/91526
	* passes.def: Note that after late FRE we do TODO_update_address_taken.
	* tree-ssa-sccvn.c (pass_fre::execute): In late mode schedule


Index: gcc/passes.def
--- gcc/passes.def	(revision 274843)
+++ gcc/passes.def	(working copy)
@@ -313,6 +313,8 @@  along with GCC; see the file COPYING3.
       NEXT_PASS (pass_split_paths);
       NEXT_PASS (pass_tracer);
       NEXT_PASS (pass_fre, false /* may_iterate */);
+      /* After late FRE we rewrite no longer addressed locals into SSA
+         form if possible.  */
       NEXT_PASS (pass_thread_jumps);
       NEXT_PASS (pass_dominator, false /* may_peel_loop_headers_p */);
       NEXT_PASS (pass_strlen);
Index: gcc/tree-ssa-sccvn.c
--- gcc/tree-ssa-sccvn.c	(revision 274843)
+++ gcc/tree-ssa-sccvn.c	(working copy)
@@ -7312,6 +7415,11 @@  pass_fre::execute (function *fun)
   if (iterate_p)
     loop_optimizer_finalize ();
+  /* For late FRE after IVOPTs and unrolling, see if we can
+     remove some TREE_ADDRESSABLE and rewrite stuff into SSA.  */
+  if (!may_iterate)
+    todo |= TODO_update_address_taken;
   return todo;