aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2005-08-19 10:54:16 -0700
committerDevang Patel <dpatel@gcc.gnu.org>2005-08-19 10:54:16 -0700
commit3d91803a0bef3a11c5ef7ff86a51fa91a2bcd581 (patch)
tree1016344868a3b33776af1c9c10fcdd485a44ec50 /gcc
parente55ef7f426bab0863601f5f0d3e7a98e87806c5d (diff)
downloadgcc-3d91803a0bef3a11c5ef7ff86a51fa91a2bcd581.zip
gcc-3d91803a0bef3a11c5ef7ff86a51fa91a2bcd581.tar.gz
gcc-3d91803a0bef3a11c5ef7ff86a51fa91a2bcd581.tar.bz2
re PR tree-optimization/23048 (ICE in get_loop_body with -O1 -ftree-vectorize on 4.1.x)
PR tree-optimization/23048 * tree-if-conv.c (if_convertible_bb_p): Supply basic_block as third parameter. Check whether latch is dominated by exit block or not. (if_convertible_loop_p): Supply exit block itself to if_convertible_bb_p. * gcc.dg/tree-ssa/pr23048.c: New test. From-SVN: r103287
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr23048.c11
-rw-r--r--gcc/tree-if-conv.c20
4 files changed, 39 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d325007..7631710 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2005-08-19 Devang Patel <dpatel@apple.com>
+
+ PR tree-optimization/23048
+ * tree-if-conv.c (if_convertible_bb_p): Supply basic_block as
+ third parameter. Check whether latch is dominated by exit
+ block or not.
+ (if_convertible_loop_p): Supply exit block itself to
+ if_convertible_bb_p.
+
2005-08-19 Richard Earnshaw <richard.earnshaw@arm.com>
PR target/23473
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c8dfcfb..ffb5f05 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2005-08-19 Devang Patel <dpatel@apple.com>
+
+ PR tree-optimization/23048
+ * gcc.dg/tree-ssa/pr23048.c: New test.
+
2005-08-19 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/20624
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr23048.c b/gcc/testsuite/gcc.dg/tree-ssa/pr23048.c
new file mode 100644
index 0000000..7dc67ea
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr23048.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -ftree-vectorize" } */
+
+void f(unsigned char *mem)
+{
+ int i;
+
+ for(i=0;i<4;i++) {
+ while(mem[i]==0) ;
+ }
+}
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index 11f0ca1..303ae2b 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -110,7 +110,7 @@ static void tree_if_convert_cond_expr (struct loop *, tree, tree,
static bool if_convertible_phi_p (struct loop *, basic_block, tree);
static bool if_convertible_modify_expr_p (struct loop *, basic_block, tree);
static bool if_convertible_stmt_p (struct loop *, basic_block, tree);
-static bool if_convertible_bb_p (struct loop *, basic_block, bool);
+static bool if_convertible_bb_p (struct loop *, basic_block, basic_block);
static bool if_convertible_loop_p (struct loop *, bool);
static void add_to_predicate_list (basic_block, tree);
static tree add_to_dst_predicate_list (struct loop * loop, basic_block, tree, tree,
@@ -437,7 +437,7 @@ if_convertible_stmt_p (struct loop *loop, basic_block bb, tree stmt)
BB is inside loop LOOP. */
static bool
-if_convertible_bb_p (struct loop *loop, basic_block bb, bool exit_bb_seen)
+if_convertible_bb_p (struct loop *loop, basic_block bb, basic_block exit_bb)
{
edge e;
edge_iterator ei;
@@ -445,7 +445,7 @@ if_convertible_bb_p (struct loop *loop, basic_block bb, bool exit_bb_seen)
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "----------[%d]-------------\n", bb->index);
- if (exit_bb_seen)
+ if (exit_bb)
{
if (bb != loop->latch)
{
@@ -459,6 +459,14 @@ if_convertible_bb_p (struct loop *loop, basic_block bb, bool exit_bb_seen)
fprintf (dump_file, "non empty basic block after exit bb\n");
return false;
}
+ else if (bb == loop->latch
+ && bb != exit_bb
+ && !dominated_by_p (CDI_DOMINATORS, bb, exit_bb))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "latch is not dominated by exit_block\n");
+ return false;
+ }
}
/* Be less adventurous and handle only normal edges. */
@@ -494,7 +502,7 @@ if_convertible_loop_p (struct loop *loop, bool for_vectorizer ATTRIBUTE_UNUSED)
unsigned int i;
edge e;
edge_iterator ei;
- bool exit_bb_seen = false;
+ basic_block exit_bb = NULL;
/* Handle only inner most loop. */
if (!loop || loop->inner)
@@ -547,7 +555,7 @@ if_convertible_loop_p (struct loop *loop, bool for_vectorizer ATTRIBUTE_UNUSED)
{
bb = ifc_bbs[i];
- if (!if_convertible_bb_p (loop, bb, exit_bb_seen))
+ if (!if_convertible_bb_p (loop, bb, exit_bb))
return false;
/* Check statements. */
@@ -562,7 +570,7 @@ if_convertible_loop_p (struct loop *loop, bool for_vectorizer ATTRIBUTE_UNUSED)
return false;
if (bb_with_exit_edge_p (loop, bb))
- exit_bb_seen = true;
+ exit_bb = bb;
}
/* OK. Did not find any potential issues so go ahead in if-convert