summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-phiprop.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-ssa-phiprop.c')
-rw-r--r--gcc/tree-ssa-phiprop.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c
index dc1cb28f7c3..6595515e1ad 100644
--- a/gcc/tree-ssa-phiprop.c
+++ b/gcc/tree-ssa-phiprop.c
@@ -139,7 +139,7 @@ phiprop_insert_phi (basic_block bb, gimple phi, gimple use_stmt,
edge e;
gcc_assert (is_gimple_assign (use_stmt)
- && gimple_assign_rhs_code (use_stmt) == INDIRECT_REF);
+ && gimple_assign_rhs_code (use_stmt) == MEM_REF);
/* Build a new PHI node to replace the definition of
the indirect reference lhs. */
@@ -295,8 +295,11 @@ propagate_with_phi (basic_block bb, gimple phi, struct phiprop_d *phivn,
/* Check whether this is a load of *ptr. */
if (!(is_gimple_assign (use_stmt)
&& TREE_CODE (gimple_assign_lhs (use_stmt)) == SSA_NAME
- && gimple_assign_rhs_code (use_stmt) == INDIRECT_REF
+ && gimple_assign_rhs_code (use_stmt) == MEM_REF
&& TREE_OPERAND (gimple_assign_rhs1 (use_stmt), 0) == ptr
+ && integer_zerop (TREE_OPERAND (gimple_assign_rhs1 (use_stmt), 1))
+ && types_compatible_p (TREE_TYPE (gimple_assign_rhs1 (use_stmt)),
+ TREE_TYPE (TREE_TYPE (ptr)))
/* We cannot replace a load that may throw or is volatile. */
&& !stmt_can_throw_internal (use_stmt)))
continue;