summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa.c
diff options
context:
space:
mode:
authorrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2004-11-14 18:04:25 +0000
committerrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2004-11-14 18:04:25 +0000
commita64230af82322369a965777aa52d931a3ad7e93f (patch)
tree4342616d30f20c349279f331a6f1ad5af6c0e53b /gcc/tree-ssa.c
parent877071a72f300a2e72bf8600db6acea1a873ca59 (diff)
downloadgcc-a64230af82322369a965777aa52d931a3ad7e93f.tar.gz
PR tree-optimization/18431
* tree-flow.h (stmt_references_memory_p): Declare. * tree-ssa-loop-im.c (stmt_cost): Use stmt_references_memory_p. * tree-ssa.c (stmt_references_memory_p): New function. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@90624 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa.c')
-rw-r--r--gcc/tree-ssa.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index d0419b70dff..4cb8cc2bc81 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -902,6 +902,23 @@ tree_ssa_useless_type_conversion (tree expr)
return false;
}
+/* Returns true if statement STMT may read memory. */
+
+bool
+stmt_references_memory_p (tree stmt)
+{
+ stmt_ann_t ann;
+
+ get_stmt_operands (stmt);
+ ann = stmt_ann (stmt);
+
+ if (ann->has_volatile_ops)
+ return true;
+
+ return (NUM_VUSES (VUSE_OPS (ann)) > 0
+ || NUM_V_MAY_DEFS (V_MAY_DEF_OPS (ann)) > 0
+ || NUM_V_MUST_DEFS (V_MUST_DEF_OPS (ann)) > 0);
+}
/* Internal helper for walk_use_def_chains. VAR, FN and DATA are as
described in walk_use_def_chains.