aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDorit Nuzman <dorit@il.ibm.com>2005-06-02 14:52:18 +0000
committerDorit Nuzman <dorit@gcc.gnu.org>2005-06-02 14:52:18 +0000
commited3c16fbe6ae0685a7617b5287d3de1ff464d5ae (patch)
tree70efda32e52ad7147632f73b19b89bfc258edbc6
parent9419649c017669b08911458bc16ac18e2792bc56 (diff)
downloadgcc-ed3c16fbe6ae0685a7617b5287d3de1ff464d5ae.zip
gcc-ed3c16fbe6ae0685a7617b5287d3de1ff464d5ae.tar.gz
gcc-ed3c16fbe6ae0685a7617b5287d3de1ff464d5ae.tar.bz2
re PR tree-optimization/21734 (ICE: -ftree-vectorize, segfault)
PR tree-optimization/21734 * tree-vectorizer.c (slpeel_update_phis_for_duplicate_loop): Use the phi_result when current_def is not available. (slpeel_update_phi_nodes_for_guard1): Don't fail if current_def is not available. From-SVN: r100494
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/vect/pr21734_1.cc20
-rw-r--r--gcc/testsuite/g++.dg/vect/pr21734_2.cc16
-rw-r--r--gcc/tree-vectorizer.c14
5 files changed, 61 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 600266d..ced17d5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2005-06-02 Dorit Nuzman <dorit@il.ibm.com>
+
+ PR tree-optimization/21734
+ * tree-vectorizer.c (slpeel_update_phis_for_duplicate_loop): Use the
+ phi_result when current_def is not available.
+ (slpeel_update_phi_nodes_for_guard1): Don't fail if current_def is not
+ available.
+
2005-06-02 David Edelsohn <edelsohn@gnu.org>
* config/rs6000/rs6000.c (rs6000_insn_valid_within_doloop): New.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 4735903..9222799 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2005-06-02 Dorit Nuzman <dorit@il.ibm.com>
+
+ PR tree-optimization/21734
+ * g++.dg/vect/pr21734_1.cc: New.
+ * g++.dg/vect/pr21734_2.cc: New.
+
2005-06-02 Nathan Sidwell <nathan@codesourcery.com>
PR c++/20350
diff --git a/gcc/testsuite/g++.dg/vect/pr21734_1.cc b/gcc/testsuite/g++.dg/vect/pr21734_1.cc
new file mode 100644
index 0000000..c65d9fc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/pr21734_1.cc
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+
+struct A
+{
+ int a[4];
+ int& operator[](int i) { return a[i]; }
+};
+
+struct B : public A
+{
+ int& operator[](int i) { return A::operator[](i); }
+};
+
+void foo(B &b)
+{
+ for (int i=0; i<4; ++i)
+ b[i] = 0;
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/g++.dg/vect/pr21734_2.cc b/gcc/testsuite/g++.dg/vect/pr21734_2.cc
new file mode 100644
index 0000000..58efedf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/pr21734_2.cc
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+struct A
+{
+ int a[4];
+ int* operator[](int i) { return &a[i]; }
+};
+
+void foo(A a1, A &a2)
+{
+ a1[1][1]=0;
+ for (int i=0; i<4; ++i)
+ a2.a[i]=0;
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index c8985b9..883f403 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -320,8 +320,11 @@ slpeel_update_phis_for_duplicate_loop (struct loop *orig_loop,
new_ssa_name = get_current_def (def);
if (!new_ssa_name)
- /* Something defined outside of the loop. */
- continue;
+ {
+ /* This only happens if there are no definitions
+ inside the loop. use the phi_result in this case. */
+ new_ssa_name = PHI_RESULT (phi_new);
+ }
/* An ordinary ssa name defined in the loop. */
add_phi_arg (phi_new, new_ssa_name, loop_latch_edge (new_loop));
@@ -565,7 +568,12 @@ slpeel_update_phi_nodes_for_guard1 (edge guard_edge, struct loop *loop,
else
{
current_new_name = get_current_def (loop_arg);
- gcc_assert (current_new_name);
+ /* current_def is not available only if the variable does not
+ change inside the loop, in which case we also don't care
+ about recording a current_def for it because we won't be
+ trying to create loop-exit-phis for it. */
+ if (!current_new_name)
+ continue;
}
#ifdef ENABLE_CHECKING
gcc_assert (get_current_def (current_new_name) == NULL_TREE);