aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vrp.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@gcc.gnu.org>2013-11-07 15:28:57 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2013-11-07 15:28:57 +0100
commitd23c0a32ab98d6c170970bb1ee319c6fc967852d (patch)
tree37d8f2f72fa52335e8f3aedab00ddc0e57ef358a /gcc/tree-vrp.c
parentfe79fc067e750e2e8a7e22861a088b8fde07ebbc (diff)
downloadgcc-d23c0a32ab98d6c170970bb1ee319c6fc967852d.zip
gcc-d23c0a32ab98d6c170970bb1ee319c6fc967852d.tar.gz
gcc-d23c0a32ab98d6c170970bb1ee319c6fc967852d.tar.bz2
tree-vrp.c (find_assert_locations): Pre-seed live bitmaps for loop latches from header PHI arguments from the latch...
* tree-vrp.c (find_assert_locations): Pre-seed live bitmaps for loop latches from header PHI arguments from the latch edge. * gcc.dg/unroll_1.c: Add -fno-tree-vrp to dg-options. * gcc.dg/unroll_2.c: Likewise. * gcc.dg/unroll_3.c: Likewise. * gcc.dg/unroll_4.c: Likewise. * gcc.dg/vrp90.c: New test. From-SVN: r204515
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r--gcc/tree-vrp.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 9b26f17..c1ff475 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -5904,6 +5904,34 @@ find_assert_locations (void)
for (i = 0; i < rpo_cnt; ++i)
bb_rpo[rpo[i]] = i;
+ /* Pre-seed loop latch liveness from loop header PHI nodes. Due to
+ the order we compute liveness and insert asserts we otherwise
+ fail to insert asserts into the loop latch. */
+ loop_p loop;
+ loop_iterator li;
+ FOR_EACH_LOOP (li, loop, 0)
+ {
+ i = loop->latch->index;
+ unsigned int j = single_succ_edge (loop->latch)->dest_idx;
+ for (gimple_stmt_iterator gsi = gsi_start_phis (loop->header);
+ !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple phi = gsi_stmt (gsi);
+ if (virtual_operand_p (gimple_phi_result (phi)))
+ continue;
+ tree arg = gimple_phi_arg_def (phi, j);
+ if (TREE_CODE (arg) == SSA_NAME)
+ {
+ if (live[i] == NULL)
+ {
+ live[i] = sbitmap_alloc (num_ssa_names);
+ bitmap_clear (live[i]);
+ }
+ bitmap_set_bit (live[i], SSA_NAME_VERSION (arg));
+ }
+ }
+ }
+
need_asserts = false;
for (i = rpo_cnt - 1; i >= 0; --i)
{