diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-03-24 14:43:16 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-03-24 14:43:16 +0000 |
commit | 07eeb4686cf207d4dafc913a9cccd4d6a9208849 (patch) | |
tree | 1d8153ce00daca65241e4fb2d0ed678e09967244 /gcc | |
parent | 2473bfb75ae39104bdf39593e67e51b3270fdd9e (diff) | |
download | gcc-07eeb4686cf207d4dafc913a9cccd4d6a9208849.tar.gz |
2011-03-24 Richard Guenther <rguenther@suse.de>
PR tree-optimization/48271
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Only cleanup
blocks that still exist.
* g++.dg/torture/pr48271.C: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@171395 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/torture/pr48271.C | 119 | ||||
-rw-r--r-- | gcc/tree-ssa-dom.c | 6 |
4 files changed, 134 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index edf923cbea6..4c00adc8d94 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2011-03-24 Richard Guenther <rguenther@suse.de> + PR tree-optimization/48271 + * tree-ssa-dom.c (tree_ssa_dominator_optimize): Only cleanup + blocks that still exist. + +2011-03-24 Richard Guenther <rguenther@suse.de> + PR tree-optimization/48270 * tree-ssa-phiopt.c (cond_if_else_store_replacement): Do not free datarefs before ddrs. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 47200262263..1bed864420e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-03-24 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/48271 + * g++.dg/torture/pr48271.C: New testcase. + 2011-03-24 Eric Botcazou <ebotcazou@adacore.com> * gnat.dg/array15.ad[sb]: New test. diff --git a/gcc/testsuite/g++.dg/torture/pr48271.C b/gcc/testsuite/g++.dg/torture/pr48271.C new file mode 100644 index 00000000000..5b60ccd768c --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr48271.C @@ -0,0 +1,119 @@ +// { dg-do compile } +// { dg-options "-ftree-vrp -fno-guess-branch-probability -fnon-call-exceptions" } + +void *xalloc (); +void xfree (void *); +void error (); + +static inline void * +MallocT () +{ + void *p = xalloc (); + if (!p) + error (); + return p; +} + + +struct ByteBlob +{ + int *header; + + ByteBlob(); + + ~ByteBlob () + { + Free (); + } + + int RawFree (int * p) + { + if (!p) + error (); + xfree (p); + } + + int *LengthRef (); + + void Free () + { + if (*header) + RawFree (header); + } + + int Append (int num_ints) + { + if (*header) + MallocT (); + *LengthRef () += num_ints; + } +}; + +struct CBlobT:ByteBlob +{ + ~CBlobT () + { + Free (); + } +}; + +template < class T > struct FixedSizeArray +{ + int HeaderSize; + T *data; + FixedSizeArray (); + int RefCnt () + { + return *(int *) MallocT (); + } + ~FixedSizeArray () + { + if (RefCnt ()) + for (T * pItem = data + Length (); pItem != data; pItem--) + T (); + } + int Length (); +}; + +class SmallArray +{ + typedef FixedSizeArray < int > SubArray; + typedef FixedSizeArray < SubArray > SuperArray; + SuperArray data; +}; + +struct CHashTableT +{ + int *m_slots; + ~CHashTableT () + { + delete m_slots; + } +}; + +struct CYapfBaseT +{ + int *PfGetSettings (); + SmallArray m_arr; + CHashTableT m_closed; + CYapfBaseT () + { + MallocT (); + } +}; + +struct CYapfCostRailT:CYapfBaseT +{ + CBlobT m_sig_look_ahead_costs; + CYapfCostRailT () + { + m_sig_look_ahead_costs.Append (*Yapf ()->PfGetSettings ()); + Yapf ()->PfGetSettings (); + } + CYapfBaseT *Yapf (); +}; + +void stCheckReverseTrain () +{ + CYapfCostRailT pf1; +} diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index fc87c4604c7..0f649f3cfed 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -701,7 +701,8 @@ tree_ssa_dominator_optimize (void) gimple_stmt_iterator gsi; basic_block bb; FOR_EACH_BB (bb) - {for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + { + for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) update_stmt_if_modified (gsi_stmt (gsi)); } } @@ -734,7 +735,8 @@ tree_ssa_dominator_optimize (void) EXECUTE_IF_SET_IN_BITMAP (need_eh_cleanup, 0, i, bi) { basic_block bb = BASIC_BLOCK (i); - if (single_succ_p (bb) == 1 + if (bb + && single_succ_p (bb) && (single_succ_edge (bb)->flags & EDGE_EH) == 0) { bitmap_clear_bit (need_eh_cleanup, i); |