re PR tree-optimization/24231 (SSA corruption with C++ code and exceptions and loads)
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. From-SVN: r105594
This commit is contained in:
parent
fd4aca960b
commit
b3e2e29c19
@ -1,3 +1,10 @@
|
||||
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
|
||||
|
||||
42
gcc/testsuite/g++.dg/tree-ssa/pr24231-1.C
Normal file
42
gcc/testsuite/g++.dg/tree-ssa/pr24231-1.C
Normal file
@ -0,0 +1,42 @@
|
||||
/* { 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;
|
||||
}
|
||||
|
||||
|
||||
41
gcc/testsuite/g++.dg/tree-ssa/pr24231-2.C
Normal file
41
gcc/testsuite/g++.dg/tree-ssa/pr24231-2.C
Normal file
@ -0,0 +1,41 @@
|
||||
/* { 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;
|
||||
}
|
||||
28
gcc/testsuite/g++.dg/tree-ssa/pr24231-3.C
Normal file
28
gcc/testsuite/g++.dg/tree-ssa/pr24231-3.C
Normal file
@ -0,0 +1,28 @@
|
||||
/* { 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();
|
||||
}
|
||||
@ -2187,11 +2187,13 @@ try_look_through_load (tree lhs, tree mem_ref, tree stmt, basic_block block)
|
||||
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. */
|
||||
@ -2322,7 +2324,8 @@ compute_avail (void)
|
||||
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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user