aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2018-12-03 15:13:04 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2018-12-03 15:13:04 +0000
commit867399e91a6755a13caddd40349ca19b25d4ae10 (patch)
treeae60601e518c4a1429a0132b4a9c022e58c8075a /gcc
parent8c66130b1f8460773912ca3a915f657db466fd39 (diff)
downloadgcc-867399e91a6755a13caddd40349ca19b25d4ae10.zip
gcc-867399e91a6755a13caddd40349ca19b25d4ae10.tar.gz
gcc-867399e91a6755a13caddd40349ca19b25d4ae10.tar.bz2
tree-ssa-sccvn.c (eliminate_dom_walker::eliminate_stmt): Only allow expected function-pointer cast re-instantiation.
2018-12-03 Richard Biener <rguenther@suse.de> * tree-ssa-sccvn.c (eliminate_dom_walker::eliminate_stmt): Only allow expected function-pointer cast re-instantiation. From-SVN: r266742
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/tree-ssa-sccvn.c19
2 files changed, 18 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2ac3260..bde3cd4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2018-12-03 Richard Biener <rguenther@suse.de>
+
+ * tree-ssa-sccvn.c (eliminate_dom_walker::eliminate_stmt): Only
+ allow expected function-pointer cast re-instantiation.
+
2018-12-03 Ilya Leoshkevich <iii@linux.ibm.com>
* common/config/s390/s390-common.c (s390_option_init_struct):
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 8f2b460..700aa1f 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -4984,10 +4984,6 @@ eliminate_dom_walker::eliminate_stmt (basic_block b, gimple_stmt_iterator *gsi)
return;
/* Else replace its RHS. */
- bool can_make_abnormal_goto
- = is_gimple_call (stmt)
- && stmt_can_make_abnormal_goto (stmt);
-
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Replaced ");
@@ -4997,12 +4993,23 @@ eliminate_dom_walker::eliminate_stmt (basic_block b, gimple_stmt_iterator *gsi)
fprintf (dump_file, " in ");
print_gimple_stmt (dump_file, stmt, 0);
}
-
eliminations++;
+
+ bool can_make_abnormal_goto = (is_gimple_call (stmt)
+ && stmt_can_make_abnormal_goto (stmt));
gimple *orig_stmt = stmt;
if (!useless_type_conversion_p (TREE_TYPE (lhs),
TREE_TYPE (sprime)))
- sprime = fold_convert (TREE_TYPE (lhs), sprime);
+ {
+ /* We preserve conversions to but not from function or method
+ types. This asymmetry makes it necessary to re-instantiate
+ conversions here. */
+ if (POINTER_TYPE_P (TREE_TYPE (lhs))
+ && FUNC_OR_METHOD_TYPE_P (TREE_TYPE (TREE_TYPE (lhs))))
+ sprime = fold_convert (TREE_TYPE (lhs), sprime);
+ else
+ gcc_unreachable ();
+ }
tree vdef = gimple_vdef (stmt);
tree vuse = gimple_vuse (stmt);
propagate_tree_value_into_stmt (gsi, sprime);