diff options
author | Richard Guenther <rguenther@suse.de> | 2011-01-17 14:48:35 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2011-01-17 14:48:35 +0000 |
commit | 6ff382305327c639508f9fe6b24996e42da6cc64 (patch) | |
tree | 90224228b70b15261f8541e74e1bbc229d63cda5 /gcc | |
parent | bf5cd92b160ff9f805411025546c17769c1977bd (diff) | |
download | gcc-6ff382305327c639508f9fe6b24996e42da6cc64.zip gcc-6ff382305327c639508f9fe6b24996e42da6cc64.tar.gz gcc-6ff382305327c639508f9fe6b24996e42da6cc64.tar.bz2 |
re PR middle-end/47313 (ICE: PHI argument is not a GIMPLE value)
2011-01-17 Richard Guenther <rguenther@suse.de>
PR tree-optimization/47313
* tree-inline.c (tree_function_versioning): Move DECL_RESULT
handling before copying the body. Properly deal with
by-reference result in SSA form.
* g++.dg/torture/pr47313.C: New testcase.
From-SVN: r168907
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/torture/pr47313.C | 53 | ||||
-rw-r--r-- | gcc/tree-inline.c | 22 |
4 files changed, 81 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8b269ef..b5c8fa1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2011-01-17 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/47313 + * tree-inline.c (tree_function_versioning): Move DECL_RESULT + handling before copying the body. Properly deal with + by-reference result in SSA form. + 2011-01-17 Ian Lance Taylor <iant@google.com> PR target/47219 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8db0111..2ab6f53 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-01-17 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/47313 + * g++.dg/torture/pr47313.C: New testcase. + 2011-01-17 H.J. Lu <hongjiu.lu@intel.com> PR target/47318 diff --git a/gcc/testsuite/g++.dg/torture/pr47313.C b/gcc/testsuite/g++.dg/torture/pr47313.C new file mode 100644 index 0000000..c10f558 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr47313.C @@ -0,0 +1,53 @@ +// { dg-do compile } + +namespace internal { + template < class DSC, bool Const > struct CC_iterator { + typedef CC_iterator iterator; + typedef typename DSC::value_type value_type; + typedef const value_type* pointer; + CC_iterator () ; + CC_iterator (const iterator &it) { + } + pointer p; + pointer operator->() const ; + }; +} +template < class T > struct Compact_container { + typedef Compact_container <T> Self; + typedef T value_type; + typedef internal::CC_iterator<Self, false> iterator; +}; +template < typename TDS = void > struct Periodic_3_triangulation_ds_cell_base_3 { + typedef typename TDS::Vertex_handle Vertex_handle; + const Vertex_handle& vertex(int i) const { + } +}; +struct Triangulation_data_structure_3 { + typedef Triangulation_data_structure_3 Tds; + typedef Periodic_3_triangulation_ds_cell_base_3<Tds> Cell; + typedef Compact_container<Cell> Cell_range; + typedef Compact_container<int> Vertex_range; + typedef typename Cell_range::iterator Cell_handle; + typedef typename Vertex_range::iterator Vertex_handle; +}; +typedef Triangulation_data_structure_3 TDS1; +template < class > struct Periodic_3_Delaunay_triangulation_3 { + typedef TDS1::Vertex_handle Vertex_handle; + typedef TDS1::Cell_handle Cell_handle; + int compare_distance() const { + } + Vertex_handle nearest_vertex() const; +}; +template < class Tds > typename Periodic_3_Delaunay_triangulation_3<Tds>::Vertex_handle Periodic_3_Delaunay_triangulation_3<Tds>::nearest_vertex() const { + Cell_handle c ; + Vertex_handle nearest = c->vertex(0); + nearest = (compare_distance() == -1) ? nearest : c->vertex(0); + return nearest; +} +typedef Periodic_3_Delaunay_triangulation_3<TDS1> PDT1; +struct Periodic_3_triangulation_hierarchy_3 : PDT1 { + Vertex_handle nearest_vertex() const; +}; +Periodic_3_triangulation_hierarchy_3::Vertex_handle Periodic_3_triangulation_hierarchy_3:: nearest_vertex() const { + return PDT1::nearest_vertex(); +} diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index a73cb39..c5ab4ca 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -5173,17 +5173,27 @@ tree_function_versioning (tree old_decl, tree new_decl, /* Add local vars. */ add_local_variables (DECL_STRUCT_FUNCTION (old_decl), cfun, &id, false); - /* Copy the Function's body. */ - copy_body (&id, old_entry_block->count, REG_BR_PROB_BASE, - ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, blocks_to_copy, new_entry); - if (DECL_RESULT (old_decl) != NULL_TREE) { - tree *res_decl = &DECL_RESULT (old_decl); - DECL_RESULT (new_decl) = remap_decl (*res_decl, &id); + tree old_name; + DECL_RESULT (new_decl) = remap_decl (DECL_RESULT (old_decl), &id); lang_hooks.dup_lang_specific_decl (DECL_RESULT (new_decl)); + if (gimple_in_ssa_p (id.src_cfun) + && DECL_BY_REFERENCE (DECL_RESULT (old_decl)) + && (old_name + = gimple_default_def (id.src_cfun, DECL_RESULT (old_decl)))) + { + tree new_name = make_ssa_name (DECL_RESULT (new_decl), NULL); + insert_decl_map (&id, old_name, new_name); + SSA_NAME_DEF_STMT (new_name) = gimple_build_nop (); + set_default_def (DECL_RESULT (new_decl), new_name); + } } + /* Copy the Function's body. */ + copy_body (&id, old_entry_block->count, REG_BR_PROB_BASE, + ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, blocks_to_copy, new_entry); + /* Renumber the lexical scoping (non-code) blocks consecutively. */ number_blocks (new_decl); |