From 29b894421e0f072bc12048b5eebfabc7edc11d85 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sun, 18 Aug 2013 17:23:24 +0200 Subject: [PATCH] re PR tree-optimization/58006 (ICE compiling VegaStrike with -ffast-math -ftree-parallelize-loops=2) PR tree-optimization/58006 * tree-parloops.c (take_address_of): Don't ICE if get_name returns NULL. (eliminate_local_variables_stmt): Remove clobber stmts. * g++.dg/opt/pr58006.C: New test. From-SVN: r201827 --- gcc/ChangeLog | 7 +++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/opt/pr58006.C | 22 ++++++++++++++++++++++ gcc/tree-parloops.c | 15 ++++++++++++--- 4 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/opt/pr58006.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8579567..9fdf2c4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2013-08-18 Jakub Jelinek + + PR tree-optimization/58006 + * tree-parloops.c (take_address_of): Don't ICE if get_name + returns NULL. + (eliminate_local_variables_stmt): Remove clobber stmts. + 2013-08-18 Eric Botcazou * cgraphunit.c (handle_alias_pairs): Reset the alias flag after the diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f734674..659ce71 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-08-18 Jakub Jelinek + + PR tree-optimization/58006 + * g++.dg/opt/pr58006.C: New test. + 2013-08-18 Eric Botcazou * gnat.dg/specs/linker_alias.ads: New test. diff --git a/gcc/testsuite/g++.dg/opt/pr58006.C b/gcc/testsuite/g++.dg/opt/pr58006.C new file mode 100644 index 0000000..fd3b7be --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr58006.C @@ -0,0 +1,22 @@ +// PR tree-optimization/58006 +// { dg-do compile } +// { dg-require-effective-target pthread } +// { dg-options "-Ofast -ftree-parallelize-loops=2" } + +extern "C" float sqrtf (float); + +struct S +{ + float i, j; + float foo () const { return sqrtf (i * i + j * j); } + S () : i (1), j (1) {} +}; + +void +bar (int a, int b) +{ + int i; + float f; + for (i = a; i < b; i++) + f = S ().foo (); +} diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index cea6f03..0416745 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -494,9 +494,12 @@ take_address_of (tree obj, tree type, edge entry, if (gsi == NULL) return NULL; addr = TREE_OPERAND (*var_p, 0); - name = make_temp_ssa_name (TREE_TYPE (addr), NULL, - get_name (TREE_OPERAND - (TREE_OPERAND (*var_p, 0), 0))); + const char *obj_name + = get_name (TREE_OPERAND (TREE_OPERAND (*var_p, 0), 0)); + if (obj_name) + name = make_temp_ssa_name (TREE_TYPE (addr), NULL, obj_name); + else + name = make_ssa_name (TREE_TYPE (addr), NULL); stmt = gimple_build_assign (name, addr); gsi_insert_on_edge_immediate (entry, stmt); @@ -694,6 +697,12 @@ eliminate_local_variables_stmt (edge entry, gimple_stmt_iterator *gsi, dta.changed = true; } } + else if (gimple_clobber_p (stmt)) + { + stmt = gimple_build_nop (); + gsi_replace (gsi, stmt, false); + dta.changed = true; + } else { dta.gsi = gsi; -- 2.7.4