aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2016-08-17 08:18:47 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2016-08-17 08:18:47 +0000
commit18d0861745bb2b8446055f56b8b6f5994b7facf1 (patch)
tree95ffa3f4b47ab440ffe77f02d7ddde825eed0e2e /gcc
parent622d8b69482a3c8f2a0df0324033719a771932fd (diff)
downloadgcc-18d0861745bb2b8446055f56b8b6f5994b7facf1.zip
gcc-18d0861745bb2b8446055f56b8b6f5994b7facf1.tar.gz
gcc-18d0861745bb2b8446055f56b8b6f5994b7facf1.tar.bz2
tree-ssa.c: Include tree-cfg.h and tree-dfa.h.
2016-08-17 Richard Biener <rguenther@suse.de> * tree-ssa.c: Include tree-cfg.h and tree-dfa.h. (verify_vssa): New function verifying virtual SSA form. (verify_ssa): Call it. * tree-ssa-loop-manip.c (slpeel_update_phi_nodes_for_guard2): Do not apply loop-closed SSA handling to virtuals. * ssa-iterators.h (op_iter_init): Handle GIMPLE_TRANSACTION. * tree-into-ssa.c (prepare_use_sites_for): Skip virtual SSA names when rewriting their symbol. (prepare_def_site_for): Likewise. * tree-chkp-opt.c (chkp_reduce_bounds_lifetime): Clear virtual operands of moved stmts. From-SVN: r239524
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/ssa-iterators.h4
-rw-r--r--gcc/tree-chkp-opt.c2
-rw-r--r--gcc/tree-into-ssa.c10
-rw-r--r--gcc/tree-ssa.c110
-rw-r--r--gcc/tree-vect-loop-manip.c3
6 files changed, 143 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 467f016..e2a592c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,19 @@
2016-08-17 Richard Biener <rguenther@suse.de>
+ * tree-ssa.c: Include tree-cfg.h and tree-dfa.h.
+ (verify_vssa): New function verifying virtual SSA form.
+ (verify_ssa): Call it.
+ * tree-ssa-loop-manip.c (slpeel_update_phi_nodes_for_guard2):
+ Do not apply loop-closed SSA handling to virtuals.
+ * ssa-iterators.h (op_iter_init): Handle GIMPLE_TRANSACTION.
+ * tree-into-ssa.c (prepare_use_sites_for): Skip virtual SSA names
+ when rewriting their symbol.
+ (prepare_def_site_for): Likewise.
+ * tree-chkp-opt.c (chkp_reduce_bounds_lifetime): Clear virtual
+ operands of moved stmts.
+
+2016-08-17 Richard Biener <rguenther@suse.de>
+
PR tree-optimization/23855
* tree-ssa-loop-unswitch.c: Include tree-ssa-loop-manip.h.
(tree_unswitch_outer_loop): Iterate find_loop_guard as long as we
diff --git a/gcc/ssa-iterators.h b/gcc/ssa-iterators.h
index a7d75d6..b6d8f3c 100644
--- a/gcc/ssa-iterators.h
+++ b/gcc/ssa-iterators.h
@@ -607,6 +607,10 @@ op_iter_init (ssa_op_iter *ptr, gimple *stmt, int flags)
case GIMPLE_ASM:
ptr->numops = gimple_asm_noutputs (as_a <gasm *> (stmt));
break;
+ case GIMPLE_TRANSACTION:
+ ptr->numops = 0;
+ flags &= ~SSA_OP_DEF;
+ break;
default:
ptr->numops = 0;
flags &= ~(SSA_OP_DEF | SSA_OP_VDEF);
diff --git a/gcc/tree-chkp-opt.c b/gcc/tree-chkp-opt.c
index 52d127c..9915245 100644
--- a/gcc/tree-chkp-opt.c
+++ b/gcc/tree-chkp-opt.c
@@ -1236,6 +1236,8 @@ chkp_reduce_bounds_lifetime (void)
gsi_move_before (&i, &gsi);
}
+ gimple_set_vdef (stmt, NULL_TREE);
+ gimple_set_vuse (stmt, NULL_TREE);
update_stmt (stmt);
}
}
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
index ec522f1..7ed9b9d 100644
--- a/gcc/tree-into-ssa.c
+++ b/gcc/tree-into-ssa.c
@@ -2596,6 +2596,11 @@ prepare_use_sites_for (tree name, bool insert_phi_p)
use_operand_p use_p;
imm_use_iterator iter;
+ /* If we rename virtual operands do not update them. */
+ if (virtual_operand_p (name)
+ && cfun->gimple_df->rename_vops)
+ return;
+
FOR_EACH_IMM_USE_FAST (use_p, iter, name)
{
gimple *stmt = USE_STMT (use_p);
@@ -2631,6 +2636,11 @@ prepare_def_site_for (tree name, bool insert_phi_p)
|| !bitmap_bit_p (names_to_release,
SSA_NAME_VERSION (name)));
+ /* If we rename virtual operands do not update them. */
+ if (virtual_operand_p (name)
+ && cfun->gimple_df->rename_vops)
+ return;
+
stmt = SSA_NAME_DEF_STMT (name);
bb = gimple_bb (stmt);
if (bb)
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index fd742f2..66b50b9 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -39,6 +39,8 @@ along with GCC; see the file COPYING3. If not see
#include "tree-ssa.h"
#include "cfgloop.h"
#include "cfgexpand.h"
+#include "tree-cfg.h"
+#include "tree-dfa.h"
/* Pointer map of variable mappings, keyed by edge. */
static hash_map<edge, auto_vec<edge_var_map> > *edge_var_maps;
@@ -603,6 +605,104 @@ release_defs_bitset (bitmap toremove)
}
}
+/* Verify virtual SSA form. */
+
+bool
+verify_vssa (basic_block bb, tree current_vdef, sbitmap visited)
+{
+ bool err = false;
+
+ if (bitmap_bit_p (visited, bb->index))
+ return false;
+
+ bitmap_set_bit (visited, bb->index);
+
+ /* Pick up the single virtual PHI def. */
+ gphi *phi = NULL;
+ for (gphi_iterator si = gsi_start_phis (bb); !gsi_end_p (si);
+ gsi_next (&si))
+ {
+ tree res = gimple_phi_result (si.phi ());
+ if (virtual_operand_p (res))
+ {
+ if (phi)
+ {
+ error ("multiple virtual PHI nodes in BB %d", bb->index);
+ print_gimple_stmt (stderr, phi, 0, 0);
+ print_gimple_stmt (stderr, si.phi (), 0, 0);
+ err = true;
+ }
+ else
+ phi = si.phi ();
+ }
+ }
+ if (phi)
+ {
+ current_vdef = gimple_phi_result (phi);
+ if (TREE_CODE (current_vdef) != SSA_NAME)
+ {
+ error ("virtual definition is not an SSA name");
+ print_gimple_stmt (stderr, phi, 0, 0);
+ err = true;
+ }
+ }
+
+ /* Verify stmts. */
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
+ {
+ gimple *stmt = gsi_stmt (gsi);
+ tree vuse = gimple_vuse (stmt);
+ if (vuse)
+ {
+ if (vuse != current_vdef)
+ {
+ error ("stmt with wrong VUSE");
+ print_gimple_stmt (stderr, stmt, 0, TDF_VOPS);
+ fprintf (stderr, "expected ");
+ print_generic_expr (stderr, current_vdef, 0);
+ fprintf (stderr, "\n");
+ err = true;
+ }
+ tree vdef = gimple_vdef (stmt);
+ if (vdef)
+ {
+ current_vdef = vdef;
+ if (TREE_CODE (current_vdef) != SSA_NAME)
+ {
+ error ("virtual definition is not an SSA name");
+ print_gimple_stmt (stderr, phi, 0, 0);
+ err = true;
+ }
+ }
+ }
+ }
+
+ /* Verify destination PHI uses and recurse. */
+ edge_iterator ei;
+ edge e;
+ FOR_EACH_EDGE (e, ei, bb->succs)
+ {
+ gphi *phi = get_virtual_phi (e->dest);
+ if (phi
+ && PHI_ARG_DEF_FROM_EDGE (phi, e) != current_vdef)
+ {
+ error ("PHI node with wrong VUSE on edge from BB %d",
+ e->src->index);
+ print_gimple_stmt (stderr, phi, 0, TDF_VOPS);
+ fprintf (stderr, "expected ");
+ print_generic_expr (stderr, current_vdef, 0);
+ fprintf (stderr, "\n");
+ err = true;
+ }
+
+ /* Recurse. */
+ err |= verify_vssa (e->dest, current_vdef, visited);
+ }
+
+ return err;
+}
+
/* Return true if SSA_NAME is malformed and mark it visited.
IS_VIRTUAL is true if this SSA_NAME was found inside a virtual
@@ -1024,6 +1124,16 @@ verify_ssa (bool check_modified_stmt, bool check_ssa_operands)
free (definition_block);
+ if (gimple_vop (cfun)
+ && ssa_default_def (cfun, gimple_vop (cfun)))
+ {
+ auto_sbitmap visited (last_basic_block_for_fn (cfun) + 1);
+ bitmap_clear (visited);
+ if (verify_vssa (ENTRY_BLOCK_PTR_FOR_FN (cfun),
+ ssa_default_def (cfun, gimple_vop (cfun)), visited))
+ goto err;
+ }
+
/* Restore the dominance information to its prior known state, so
that we do not perturb the compiler's subsequent behavior. */
if (orig_dom_state == DOM_NONE)
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index ec863b4..90b7df9 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -607,6 +607,9 @@ slpeel_update_phi_nodes_for_guard2 (edge guard_edge, struct loop *loop,
/** 2. Handle loop-closed-ssa-form phis **/
+ if (virtual_operand_p (PHI_RESULT (orig_phi)))
+ continue;
+
/* 2.1. Generate new phi node in NEW_EXIT_BB: */
new_res = copy_ssa_name (PHI_RESULT (orig_phi));
new_phi = create_phi_node (new_res, *new_exit_bb);