From: Richard Guenther Date: Wed, 4 Mar 2009 23:00:25 +0000 (+0000) Subject: re PR tree-optimization/39362 (ICE failing to coalesce ab SSA names) X-Git-Tag: releases/gcc-4.4.0~358 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b505e785a352b4defd89de198aeeb98d3399a0b1;p=thirdparty%2Fgcc.git re PR tree-optimization/39362 (ICE failing to coalesce ab SSA names) 2009-03-04 Richard Guenther PR tree-optimization/39362 * tree-ssa-sccvn.c (visit_use): Stores and copies from SSA_NAMEs that occur in abnormal PHIs should be varying. * g++.dg/torture/pr39362.C: New testcase. From-SVN: r144626 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 451eafadddac..333fd9dbcd54 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2009-03-04 Richard Guenther + + PR tree-optimization/39362 + * tree-ssa-sccvn.c (visit_use): Stores and copies from SSA_NAMEs + that occur in abnormal PHIs should be varying. + 2009-03-04 Zdenek Dvorak * tree-scalar-evolution.c (analyze_scalar_evolution_in_loop): diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 97668fd82dfd..ca0a6ee8ad09 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-03-04 Richard Guenther + + PR tree-optimization/39362 + * g++.dg/torture/pr39362.C: New testcase. + 2009-03-04 Jason Merrill Giovanni Bajo diff --git a/gcc/testsuite/g++.dg/torture/pr39362.C b/gcc/testsuite/g++.dg/torture/pr39362.C new file mode 100644 index 000000000000..fb23439f595c --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr39362.C @@ -0,0 +1,105 @@ +/* { dg-do compile } */ + +void *fastMalloc (int n); +void fastFree (void *p); +template struct C +{ + void deref () { delete static_cast (this); } +}; +template +struct D +{ + D (T *ptr) : m_ptr (ptr) { } + ~D () { if (T * ptr = m_ptr) ptr->deref (); } + T *operator-> () const; + T *m_ptr; + typedef T *UnspecifiedBoolType; + operator UnspecifiedBoolType () const; +}; +template struct E +{ + static void destruct (T * begin, T * end) + { + for (T * cur = begin; cur != end; ++cur) + cur->~T (); + } +}; +template class F; +template struct G +{ + static void destruct (T * begin, T * end) + { + E ::destruct (begin, end); + } + static void uninitializedFill (T * dst, T * dstEnd, const T & val) + { + F::uninitializedFill (dst, dstEnd, val); + } +}; +template struct H +{ + void allocateBuffer (int newCapacity) + { + m_buffer = static_cast (fastMalloc (newCapacity * sizeof (T))); + } + void deallocateBuffer (T * bufferToDeallocate) + { + if (m_buffer == bufferToDeallocate) + fastFree (bufferToDeallocate); + } + T *buffer () { } + int capacity () const { } + T *m_buffer; +}; +template class I; +template struct I : H +{ + I (int capacity) { allocateBuffer (capacity); } + ~I () { deallocateBuffer (buffer ()); } + using H ::allocateBuffer; + H ::buffer; +}; +template struct J +{ + typedef T *iterator; + ~J () { if (m_size) shrink (0); } + J (const J &); + int capacity () const { m_buffer.capacity (); } + T & operator[](int i) { } + iterator begin () { } + iterator end () { return begin () + m_size; } + void shrink (int size); + template void append (const U &); + int m_size; + I m_buffer; +}; +template +J ::J (const J & other) : m_buffer (other.capacity ()) +{ +} +template +void J ::shrink (int size) +{ + G ::destruct (begin () + size, end ()); + m_size = size; +} +struct A : public C +{ + virtual ~A (); + typedef J > B; + virtual A *firstChild () const; + virtual A *nextSibling () const; + virtual const B & children (int length); + B m_children; +}; +const A::B & +A::children (int length) +{ + for (D obj = firstChild (); obj; obj = obj->nextSibling ()) + { + B children = obj->children (2); + for (unsigned i = 0; i expr = NULL_TREE; } - if (TREE_CODE (lhs) == SSA_NAME - /* We can substitute SSA_NAMEs that are live over - abnormal edges with their constant value. */ - && !(gimple_assign_copy_p (stmt) - && is_gimple_min_invariant (gimple_assign_rhs1 (stmt))) - && !(simplified - && is_gimple_min_invariant (simplified)) - && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs)) + if ((TREE_CODE (lhs) == SSA_NAME + /* We can substitute SSA_NAMEs that are live over + abnormal edges with their constant value. */ + && !(gimple_assign_copy_p (stmt) + && is_gimple_min_invariant (gimple_assign_rhs1 (stmt))) + && !(simplified + && is_gimple_min_invariant (simplified)) + && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs)) + /* Stores or copies from SSA_NAMEs that are live over + abnormal edges are a problem. */ + || (gimple_assign_single_p (stmt) + && TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME + && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (gimple_assign_rhs1 (stmt)))) changed = defs_to_varying (stmt); else if (REFERENCE_CLASS_P (lhs) || DECL_P (lhs)) {