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
This commit is contained in:
Dorit Nuzman 2005-06-02 14:52:18 +00:00 committed by Dorit Nuzman
parent 9419649c01
commit ed3c16fbe6
5 changed files with 61 additions and 3 deletions

View File

@ -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.

View File

@ -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

View File

@ -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" } } */

View File

@ -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" } } */

View File

@ -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);