aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dom.c
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2020-06-17 07:50:57 -0400
committerAldy Hernandez <aldyh@redhat.com>2020-06-17 07:50:57 -0400
commitb9e67f2840ce0d8859d96e7f8df8fe9584af5eba (patch)
treeed3b7284ff15c802583f6409b9c71b3739642d15 /gcc/tree-ssa-dom.c
parent1957047ed1c94bf17cf993a2b1866965f493ba87 (diff)
parent56638b9b1853666f575928f8baf17f70e4ed3517 (diff)
downloadgcc-b9e67f2840ce0d8859d96e7f8df8fe9584af5eba.zip
gcc-b9e67f2840ce0d8859d96e7f8df8fe9584af5eba.tar.gz
gcc-b9e67f2840ce0d8859d96e7f8df8fe9584af5eba.tar.bz2
Merge from trunk at:
commit 56638b9b1853666f575928f8baf17f70e4ed3517 Author: GCC Administrator <gccadmin@gcc.gnu.org> Date: Wed Jun 17 00:16:36 2020 +0000 Daily bump.
Diffstat (limited to 'gcc/tree-ssa-dom.c')
-rw-r--r--gcc/tree-ssa-dom.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index ab4cee6..69eaec3 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -49,6 +49,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-vrp.h"
#include "vr-values.h"
#include "gimple-ssa-evrp-analyze.h"
+#include "alias.h"
/* This file implements optimizations on the dominator tree. */
@@ -874,7 +875,7 @@ simplify_stmt_for_jump_threading (gimple *stmt,
class avail_exprs_stack *avail_exprs_stack,
basic_block bb ATTRIBUTE_UNUSED)
{
- /* First query our hash table to see if the the expression is available
+ /* First query our hash table to see if the expression is available
there. A non-NULL return value will be either a constant or another
SSA_NAME. */
tree cached_lhs = avail_exprs_stack->lookup_avail_expr (stmt, false, true);
@@ -1723,11 +1724,10 @@ record_equivalences_from_stmt (gimple *stmt, int may_optimize_p,
tree op0 = gimple_assign_rhs1 (stmt);
tree op1 = gimple_assign_rhs2 (stmt);
tree new_rhs
- = build_fold_addr_expr (fold_build2 (MEM_REF,
- TREE_TYPE (TREE_TYPE (op0)),
- unshare_expr (op0),
- fold_convert (ptr_type_node,
- op1)));
+ = build1 (ADDR_EXPR, TREE_TYPE (op0),
+ fold_build2 (MEM_REF, TREE_TYPE (TREE_TYPE (op0)),
+ unshare_expr (op0), fold_convert (ptr_type_node,
+ op1)));
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "==== ASGN ");
@@ -2154,9 +2154,14 @@ dom_opt_dom_walker::optimize_stmt (basic_block bb, gimple_stmt_iterator *si,
else
new_stmt = gimple_build_assign (rhs, lhs);
gimple_set_vuse (new_stmt, gimple_vuse (stmt));
+ expr_hash_elt *elt = NULL;
cached_lhs = m_avail_exprs_stack->lookup_avail_expr (new_stmt, false,
- false);
- if (cached_lhs && operand_equal_p (rhs, cached_lhs, 0))
+ false, &elt);
+ if (cached_lhs
+ && operand_equal_p (rhs, cached_lhs, 0)
+ && refs_same_for_tbaa_p (elt->expr ()->kind == EXPR_SINGLE
+ ? elt->expr ()->ops.single.rhs
+ : NULL_TREE, lhs))
{
basic_block bb = gimple_bb (stmt);
unlink_stmt_vdef (stmt);