diff mbox

Clear LOOP_CLOSED_SSA after pass_ccp

Message ID 564A4BA8.6000309@mentor.com
State New
Headers show

Commit Message

Tom de Vries Nov. 16, 2015, 9:33 p.m. UTC
Hi,

while playing around with inserting pass_ccp here and there in the pass 
list, I put it after a pass where the loops state contained LOOP_CLOSED_SSA.

And apparently pass_ccp does not preserve loop-closed ssa.

As a consequence, during executing the pass_ccp todos, 
verify_loop_closed_ssa fails.

This patch fixes that by noting in pass_ccp that it does not preserve 
loop-closed ssa.

OK for trunk if bootstrap and reg-test succeeds?

Thanks,
- Tom

Comments

Jeff Law Nov. 16, 2015, 10:01 p.m. UTC | #1
On 11/16/2015 02:33 PM, Tom de Vries wrote:
> Hi,
>
> while playing around with inserting pass_ccp here and there in the pass
> list, I put it after a pass where the loops state contained
> LOOP_CLOSED_SSA.
>
> And apparently pass_ccp does not preserve loop-closed ssa.
>
> As a consequence, during executing the pass_ccp todos,
> verify_loop_closed_ssa fails.
>
> This patch fixes that by noting in pass_ccp that it does not preserve
> loop-closed ssa.
>
> OK for trunk if bootstrap and reg-test succeeds?
OK.
jeff
diff mbox

Patch

Clear LOOP_CLOSED_SSA after pass_ccp

2015-11-16  Tom de Vries  <tom@codesourcery.com>

	* tree-ssa-ccp.c (do_ssa_ccp): Clear LOOP_CLOSED_SSA in loops state if
	something changed.

---
 gcc/tree-ssa-ccp.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 7b6b451..7e8bc52 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -139,6 +139,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "params.h"
 #include "builtins.h"
 #include "tree-chkp.h"
+#include "cfgloop.h"
 
 
 /* Possible lattice values.  */
@@ -2402,10 +2403,17 @@  do_ssa_ccp (bool nonzero_p)
 {
   unsigned int todo = 0;
   calculate_dominance_info (CDI_DOMINATORS);
+
   ccp_initialize ();
   ssa_propagate (ccp_visit_stmt, ccp_visit_phi_node);
   if (ccp_finalize (nonzero_p))
-    todo = (TODO_cleanup_cfg | TODO_update_ssa);
+    {
+      todo = (TODO_cleanup_cfg | TODO_update_ssa);
+
+      /* ccp_finalize does not preserve loop-closed ssa.  */
+      loops_state_clear (LOOP_CLOSED_SSA);
+    }
+
   free_dominance_info (CDI_DOMINATORS);
   return todo;
 }