summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-im.c
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-01 13:40:35 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-01 13:40:35 +0000
commit6d7105fe4a7d259ce5b9d2d1f90282a45d82af07 (patch)
tree3d1a42a39b3f8ad8f92b0f63c0dbd403f943ed08 /gcc/tree-ssa-loop-im.c
parentcf4089a8eb480cd4e6f1f5e78e249072a4b986c9 (diff)
downloadgcc-6d7105fe4a7d259ce5b9d2d1f90282a45d82af07.tar.gz
* tree.h (copy_mem_ref_info): Delete.
* tree-ssa-address.c (copy_mem_ref_info): Likewise. (maybe_fold_tmr): Copy flags manually. * tree-ssa-loop-im.c (simple_mem_ref_in_stmt): Rewrite. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@191924 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-loop-im.c')
-rw-r--r--gcc/tree-ssa-loop-im.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index e76e64398ea..ac5353905df 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -638,29 +638,22 @@ outermost_indep_loop (struct loop *outer, struct loop *loop, mem_ref_p ref)
static tree *
simple_mem_ref_in_stmt (gimple stmt, bool *is_store)
{
- tree *lhs;
- enum tree_code code;
+ tree *lhs, *rhs;
- /* Recognize MEM = (SSA_NAME | invariant) and SSA_NAME = MEM patterns. */
- if (gimple_code (stmt) != GIMPLE_ASSIGN)
+ /* Recognize SSA_NAME = MEM and MEM = (SSA_NAME | invariant) patterns. */
+ if (!gimple_assign_single_p (stmt))
return NULL;
- code = gimple_assign_rhs_code (stmt);
-
lhs = gimple_assign_lhs_ptr (stmt);
+ rhs = gimple_assign_rhs1_ptr (stmt);
- if (TREE_CODE (*lhs) == SSA_NAME)
+ if (TREE_CODE (*lhs) == SSA_NAME && gimple_vuse (stmt))
{
- if (get_gimple_rhs_class (code) != GIMPLE_SINGLE_RHS
- || !is_gimple_addressable (gimple_assign_rhs1 (stmt)))
- return NULL;
-
*is_store = false;
- return gimple_assign_rhs1_ptr (stmt);
+ return rhs;
}
- else if (code == SSA_NAME
- || (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS
- && is_gimple_min_invariant (gimple_assign_rhs1 (stmt))))
+ else if (gimple_vdef (stmt)
+ && (TREE_CODE (*rhs) == SSA_NAME || is_gimple_min_invariant (*rhs)))
{
*is_store = true;
return lhs;