Commit 6ff38230 by Richard Guenther Committed by Richard Biener

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
parent bf5cd92b
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> 2011-01-17 Ian Lance Taylor <iant@google.com>
PR target/47219 PR target/47219
......
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> 2011-01-17 H.J. Lu <hongjiu.lu@intel.com>
PR target/47318 PR target/47318
......
// { 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();
}
...@@ -5173,16 +5173,26 @@ tree_function_versioning (tree old_decl, tree new_decl, ...@@ -5173,16 +5173,26 @@ tree_function_versioning (tree old_decl, tree new_decl,
/* Add local vars. */ /* Add local vars. */
add_local_variables (DECL_STRUCT_FUNCTION (old_decl), cfun, &id, false); 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) if (DECL_RESULT (old_decl) != NULL_TREE)
{ {
tree *res_decl = &DECL_RESULT (old_decl); tree old_name;
DECL_RESULT (new_decl) = remap_decl (*res_decl, &id); DECL_RESULT (new_decl) = remap_decl (DECL_RESULT (old_decl), &id);
lang_hooks.dup_lang_specific_decl (DECL_RESULT (new_decl)); 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. */ /* Renumber the lexical scoping (non-code) blocks consecutively. */
number_blocks (new_decl); number_blocks (new_decl);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment