Fix PR tree-optimization/24231
* tree-ssa-pre.c (try_look_through_load): Skip abnormal phi names
(compute_avail): Ditto.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@105594
138bc75d-0d04-0410-961f-
82ee72b054a4
+2005-10-18 Daniel Berlin <dberlin@dberlin.org>
+
+ Fix PR tree-optimization/24231
+
+ * tree-ssa-pre.c (try_look_through_load): Skip abnormal phi names
+ (compute_avail): Ditto.
+
2006-10-18 Richard Henderson <rth@redhat.com>
PR target/24428
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* FRE testcase for PR 24231, problem with PRE coalescing abnormal phis. */
+struct f
+{
+ int i;
+};
+struct h{h();};
+int g(void);
+int g1(void) throw();
+int h2222(f*);
+void ghh(int);
+
+int main(void)
+{
+ int i;
+ f t;
+ try
+ {
+ i = g1();
+ try
+ {
+ i = g();
+ }catch(...)
+ {}
+ int j = i;
+ try
+ { t.i = i;
+ i = g();
+ }catch(...)
+ {}
+ i = 2;
+ int h = t.i;
+ ghh (h);
+
+ g();
+ }catch(...)
+ {}
+ return i;
+}
+
+
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* FRE testcase for PR 24231, problem with PRE coalescing abnormal phis. */
+struct f
+{
+ int i;
+};
+struct h{h();};
+int g(void);
+int g1(void) throw();
+int h2222(f*);
+void ghh(int);
+
+int main(void)
+{
+ int i;
+ f t;
+ try
+ {
+ i = g1();
+ try
+ {
+ i = g();
+ }catch(...)
+ {}
+ int j = i;
+ try
+ {
+ i = g();
+ }catch(...)
+ {}
+ t.i = j;
+ i = 2;
+ int h = t.i;
+ ghh (h);
+
+ g();
+ }catch(...)
+ {}
+ return i;
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* PRE testcase for PR 24231, problem with PRE coalescing abnormal phis. */
+struct MemoryManager {
+ virtual void deallocate() = 0;
+};
+struct XalanVector {
+ ~XalanVector() {
+ m_memoryManager->deallocate();
+ }
+ void swap(XalanVector& theOther) {
+ MemoryManager* const theTempManager = m_memoryManager;
+ m_memoryManager = theOther.m_memoryManager;
+ theOther.m_memoryManager = theTempManager;
+ theOther.m_size = 0;
+ }
+ void push_back() {
+ XalanVector theTemp(*this);
+ theTemp.push_back();
+ swap(theTemp);
+ }
+ MemoryManager* m_memoryManager;
+ int m_size;
+};
+void f(void) {
+ XalanVector tempVector;
+ tempVector.push_back();
+}
that all of them come from the same statement STORE_STMT. See if there
is a useful expression we can deduce from STORE_STMT. */
rhs = TREE_OPERAND (store_stmt, 1);
- if (TREE_CODE (rhs) == SSA_NAME
+ if ((TREE_CODE (rhs) == SSA_NAME
+ && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs))
|| is_gimple_min_invariant (rhs)
|| TREE_CODE (rhs) == ADDR_EXPR
|| TREE_INVARIANT (rhs))
{
+
/* Yay! Compute a value number for the RHS of the statement and
add its value to the AVAIL_OUT set for the block. Add the LHS
to TMP_GEN. */
continue;
}
}
- else if (TREE_CODE (rhs) == SSA_NAME
+ else if ((TREE_CODE (rhs) == SSA_NAME
+ && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs))
|| is_gimple_min_invariant (rhs)
|| TREE_CODE (rhs) == ADDR_EXPR
|| TREE_INVARIANT (rhs)