aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2011-01-17 14:48:35 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2011-01-17 14:48:35 +0000
commit6ff382305327c639508f9fe6b24996e42da6cc64 (patch)
tree90224228b70b15261f8541e74e1bbc229d63cda5 /gcc/tree-inline.c
parentbf5cd92b160ff9f805411025546c17769c1977bd (diff)
downloadgcc-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/tree-inline.c')
-rw-r--r--gcc/tree-inline.c22
1 files changed, 16 insertions, 6 deletions
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);