Message ID | AANLkTi=cUFUKTTdFnX3wDXj=PwjM1zDKG40VgHv0kXss@mail.gmail.com |
---|---|
State | New |
Headers | show |
On Mon, 30 Aug 2010, H.J. Lu wrote: > On Mon, Aug 30, 2010 at 6:27 AM, Richard Guenther <rguenther@suse.de> wrote: > > On Mon, 30 Aug 2010, H.J. Lu wrote: > > > >> On Wed, Aug 25, 2010 at 3:45 AM, Richard Guenther <rguenther@suse.de> wrote: > >> > > >> > In sincos detection we forgot to properly move EH regions. Fixed as > >> > follows. > >> > > >> > Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk > >> > sofar. > >> > > >> > Richard. > >> > > >> > 2010-08-25 Richard Guenther <rguenther@suse.de> > >> > > >> > PR tree-optimization/45393 > >> > * tree-ssa-math-opts.c (execute_cse_sincos_1): Properly transfer > >> > and clean EH info. Avoid SSA update. > >> > (execute_cse_sincos): Cleanup the CFG if it has changed. > >> > > >> > * g++.dg/torture/pr45393.C: New testcase. > >> > > >> > >> I backported it to gcc 4.5. OK for 4.5? > > > > Ok. > > > > On 4.4 branch, I got > > pr45393.cc:20: error: BB 4 can not throw but has EH edges > pr45393.cc:20: error: BB 5 can not throw but has EH edges > pr45393.cc:20: internal compiler error: verify_flow_info failed > Please submit a full bug report, > with preprocessed source if appropriate. > See <http://gcc.gnu.org/bugs.html> for instructions. > > when checking isn't disabled. Here is the patch for 4.4. OK > for 4.4 if regression tests on Linux/x86-64 pass? Ok. Thanks, Richard.
On Mon, Aug 30, 2010 at 7:01 AM, Richard Guenther <rguenther@suse.de> wrote: > On Mon, 30 Aug 2010, H.J. Lu wrote: > >> On Mon, Aug 30, 2010 at 6:27 AM, Richard Guenther <rguenther@suse.de> wrote: >> > On Mon, 30 Aug 2010, H.J. Lu wrote: >> > >> >> On Wed, Aug 25, 2010 at 3:45 AM, Richard Guenther <rguenther@suse.de> wrote: >> >> > >> >> > In sincos detection we forgot to properly move EH regions. Fixed as >> >> > follows. >> >> > >> >> > Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk >> >> > sofar. >> >> > >> >> > Richard. >> >> > >> >> > 2010-08-25 Richard Guenther <rguenther@suse.de> >> >> > >> >> > PR tree-optimization/45393 >> >> > * tree-ssa-math-opts.c (execute_cse_sincos_1): Properly transfer >> >> > and clean EH info. Avoid SSA update. >> >> > (execute_cse_sincos): Cleanup the CFG if it has changed. >> >> > >> >> > * g++.dg/torture/pr45393.C: New testcase. >> >> > >> >> >> >> I backported it to gcc 4.5. OK for 4.5? >> > >> > Ok. >> > >> >> On 4.4 branch, I got >> >> pr45393.cc:20: error: BB 4 can not throw but has EH edges >> pr45393.cc:20: error: BB 5 can not throw but has EH edges >> pr45393.cc:20: internal compiler error: verify_flow_info failed >> Please submit a full bug report, >> with preprocessed source if appropriate. >> See <http://gcc.gnu.org/bugs.html> for instructions. >> >> when checking isn't disabled. Here is the patch for 4.4. OK >> for 4.4 if regression tests on Linux/x86-64 pass? > > Ok. > It doesn't work. I got FAIL: 26_numerics/complex/13450.cc (test for excess errors) FAIL: gcc.c-torture/compile/pr34966.c -O1 (internal compiler error) FAIL: gcc.c-torture/compile/pr34966.c -O1 (test for excess errors) FAIL: gcc.c-torture/compile/pr34966.c -O2 (internal compiler error) FAIL: gcc.c-torture/compile/pr34966.c -O2 (test for excess errors) FAIL: gcc.c-torture/compile/pr34966.c -O3 -fomit-frame-pointer (internal compiler error) FAIL: gcc.c-torture/compile/pr34966.c -O3 -fomit-frame-pointer (test for excess errors) FAIL: gcc.c-torture/compile/pr34966.c -O3 -g (internal compiler error) FAIL: gcc.c-torture/compile/pr34966.c -O3 -g (test for excess errors) FAIL: gcc.c-torture/compile/pr34966.c -Os (internal compiler error) FAIL: gcc.c-torture/compile/pr34966.c -Os (test for excess errors) FAIL: gcc.dg/builtins-36.c (internal compiler error) FAIL: gcc.dg/builtins-36.c (test for excess errors) FAIL: gcc.dg/builtins-62.c (internal compiler error) FAIL: gcc.dg/builtins-62.c scan-tree-dump-times optimized "cexpi" 3 FAIL: gcc.dg/builtins-62.c (test for excess errors) FAIL: gcc.target/i386/387-7.c (internal compiler error) FAIL: gcc.target/i386/387-7.c (test for excess errors) FAIL: gcc.target/i386/387-9.c (internal compiler error) FAIL: gcc.target/i386/387-9.c (test for excess errors) FAIL: gfortran.dg/pr35662.f90 -O0 (internal compiler error) FAIL: gfortran.dg/pr35662.f90 -O0 (test for excess errors) FAIL: gfortran.dg/pr35662.f90 -O1 (internal compiler error) FAIL: gfortran.dg/pr35662.f90 -O1 (test for excess errors) FAIL: gfortran.dg/pr35662.f90 -O2 (internal compiler error) FAIL: gfortran.dg/pr35662.f90 -O2 (test for excess errors) FAIL: gfortran.dg/pr35662.f90 -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions (internal compiler error) FAIL: gfortran.dg/pr35662.f90 -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions (test for excess errors) FAIL: gfortran.dg/pr35662.f90 -O3 -fomit-frame-pointer -funroll-loops (internal compiler error) FAIL: gfortran.dg/pr35662.f90 -O3 -fomit-frame-pointer -funroll-loops (test for excess errors) FAIL: gfortran.dg/pr35662.f90 -O3 -fomit-frame-pointer (internal compiler error) FAIL: gfortran.dg/pr35662.f90 -O3 -fomit-frame-pointer (test for excess errors) FAIL: gfortran.dg/pr35662.f90 -O3 -g (internal compiler error) FAIL: gfortran.dg/pr35662.f90 -O3 -g (test for excess errors) FAIL: gfortran.dg/pr35662.f90 -Os (internal compiler error) FAIL: gfortran.dg/pr35662.f90 -Os (test for excess errors) FAIL: tr1/5_numerical_facilities/special_functions/09_cyl_bessel_j/check_nan.cc (test for excess errors) FAIL: tr1/5_numerical_facilities/special_functions/09_cyl_bessel_j/check_value.cc (test for excess errors) FAIL: tr1/5_numerical_facilities/special_functions/11_cyl_neumann/check_nan.cc (test for excess errors) FAIL: tr1/5_numerical_facilities/special_functions/11_cyl_neumann/check_value.cc (test for excess errors) ERROR: gcc.target/i386/387-7.c: error executing dg-final: couldn't open "387-7.s": no such file or directory ERROR: gcc.target/i386/387-9.c: error executing dg-final: couldn't open "387-9.s": no such file or directory I don't pursue it further.
diff --git a/gcc/testsuite/g++.dg/torture/pr45393.C b/gcc/testsuite/g++.dg/torture/pr45393.C new file mode 100644 index 0000000..5bf16b0 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr45393.C @@ -0,0 +1,38 @@ +// { dg-do compile } + +class FloatPoint; +class Path { +public: + ~Path(); + void moveTo(const FloatPoint&); + static void createEllipse(const FloatPoint& center, float rx, float ry); +}; +extern "C" { + extern float cosf (float); + extern float sinf (float); +} +const float piFloat = static_cast<float>(3.14159265358979323846); +class FloatPoint { +public: + FloatPoint(float x, float y) : m_x(x), m_y(y) { } + float x() const; + float y() const; + float m_x, m_y; +}; +void Path::createEllipse(const FloatPoint& center, float rx, float ry) +{ + float cx = center.x(); + float cy = center.y(); + Path path; + float x = cx; + float y = cy; + unsigned step = 0, num = 100; + while (1) { + float angle = static_cast<float>(step) / num * 2.0f * piFloat; + x = cx + cosf(angle) * rx; + y = cy + sinf(angle) * ry; + step++; + if (step == 1) + path.moveTo(FloatPoint(x, y)); + } +} diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c index cb8190b..dd615b4 100644 --- a/gcc/tree-ssa-math-opts.c +++ b/gcc/tree-ssa-math-opts.c @@ -633,7 +633,7 @@ maybe_record_sincos (VEC(gimple, heap) **stmts, result of the cexpi call we insert before the use statement that dominates all other candidates. */ -static void +static bool execute_cse_sincos_1 (tree name) { gimple_stmt_iterator gsi; @@ -644,6 +644,7 @@ execute_cse_sincos_1 (tree name) VEC(gimple, heap) *stmts = NULL; basic_block top_bb = NULL; int i; + bool cfg_changed = false; type = TREE_TYPE (name); FOR_EACH_IMM_USE_STMT (use_stmt, use_iter, name) @@ -675,16 +676,20 @@ execute_cse_sincos_1 (tree name) if (seen_cos + seen_sin + seen_cexpi <= 1) { VEC_free(gimple, heap, stmts); - return; + return false; } /* Simply insert cexpi at the beginning of top_bb but not earlier than the name def statement. */ fndecl = mathfn_built_in (type, BUILT_IN_CEXPI); if (!fndecl) - return; - res = make_rename_temp (TREE_TYPE (TREE_TYPE (fndecl)), "sincostmp"); + return false; + res = create_tmp_var (TREE_TYPE (TREE_TYPE (fndecl)), "sincostmp"); + if (TREE_CODE (TREE_TYPE (TREE_TYPE (fndecl))) == COMPLEX_TYPE + || TREE_CODE (TREE_TYPE (TREE_TYPE (fndecl))) == VECTOR_TYPE) + DECL_GIMPLE_REG_P (res) = 1; stmt = gimple_build_call (fndecl, 1, name); + res = make_ssa_name (res, stmt); gimple_call_set_lhs (stmt, res); def_stmt = SSA_NAME_DEF_STMT (name); @@ -730,11 +735,14 @@ execute_cse_sincos_1 (tree name) stmt = gimple_build_assign (gimple_call_lhs (use_stmt), rhs); gsi = gsi_for_stmt (use_stmt); - gsi_insert_after (&gsi, stmt, GSI_SAME_STMT); - gsi_remove (&gsi, true); + gsi_replace (&gsi, stmt, true); + if (gimple_purge_dead_eh_edges (gimple_bb (stmt))) + cfg_changed = true; } VEC_free(gimple, heap, stmts); + + return cfg_changed; } /* Go through all calls to sin, cos and cexpi and call execute_cse_sincos_1 @@ -744,6 +752,7 @@ static unsigned int execute_cse_sincos (void) { basic_block bb; + bool cfg_changed = false; calculate_dominance_info (CDI_DOMINATORS); @@ -770,7 +779,7 @@ execute_cse_sincos (void) CASE_FLT_FN (BUILT_IN_CEXPI): arg = gimple_call_arg (stmt, 0); if (TREE_CODE (arg) == SSA_NAME) - execute_cse_sincos_1 (arg); + cfg_changed |= execute_cse_sincos_1 (arg); break; default:; @@ -780,7 +789,7 @@ execute_cse_sincos (void) } free_dominance_info (CDI_DOMINATORS); - return 0; + return cfg_changed ? TODO_cleanup_cfg : 0; } static bool