diff options
author | Sebastian Pop <pop@cri.ensmp.fr> | 2005-05-11 13:03:31 +0200 |
---|---|---|
committer | Sebastian Pop <spop@gcc.gnu.org> | 2005-05-11 11:03:31 +0000 |
commit | 4aad410db7d0ecc97870e0861f8ccda16fca2506 (patch) | |
tree | 2b36f0d698e7273b6c6c70f5211052c8f17dcd18 | |
parent | 802fc8260d06c25a9f6df650a2b6d4f6a7a2ddb7 (diff) | |
download | gcc-4aad410db7d0ecc97870e0861f8ccda16fca2506.zip gcc-4aad410db7d0ecc97870e0861f8ccda16fca2506.tar.gz gcc-4aad410db7d0ecc97870e0861f8ccda16fca2506.tar.bz2 |
tree-data-ref.c (find_data_references_in_loop): Give up when the body of the loop contains a CALL_EXPR or an ASM_EXPR...
* tree-data-ref.c (find_data_references_in_loop): Give up when
the body of the loop contains a CALL_EXPR or an ASM_EXPR: they
may embed arbitrary side effects.
Remove the assumption that GIMPLE form contains a single array
access per statement.
When the statement contains virtual operands, fail if it is not
a MODIFY_EXPR or a CALL_EXPR.
Return after the dont know node is inserted.
From-SVN: r99573
-rw-r--r-- | gcc/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/tree-data-ref.c | 72 |
2 files changed, 64 insertions, 19 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0cc4dfb..f18f5b4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2005-05-11 Sebastian Pop <pop@cri.ensmp.fr> + + * tree-data-ref.c (find_data_references_in_loop): Give up when + the body of the loop contains a CALL_EXPR or an ASM_EXPR: they + may embed arbitrary side effects. + Remove the assumption that GIMPLE form contains a single array + access per statement. + When the statement contains virtual operands, fail if it is not + a MODIFY_EXPR or a CALL_EXPR. + Return after the dont know node is inserted. + 2005-05-11 Richard Earnshaw <richard.earnshaw@arm.com> * arm.md (negsf2, negdf2): Permit these expands when compiling for VFP. diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index e62519a..90770e2 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -2218,7 +2218,6 @@ compute_all_dependences (varray_type datarefs, tree find_data_references_in_loop (struct loop *loop, varray_type *datarefs) { - bool dont_know_node_not_inserted = true; basic_block bb, *bbs; unsigned int i; block_stmt_iterator bsi; @@ -2233,28 +2232,61 @@ find_data_references_in_loop (struct loop *loop, varray_type *datarefs) { tree stmt = bsi_stmt (bsi); - if (TREE_CODE (stmt) != MODIFY_EXPR) - continue; + /* ASM_EXPR and CALL_EXPR may embed arbitrary side effects. + Calls have side-effects, except those to const or pure + functions. */ + if ((TREE_CODE (stmt) == CALL_EXPR + && !(call_expr_flags (stmt) & (ECF_CONST | ECF_PURE))) + || (TREE_CODE (stmt) == ASM_EXPR + && ASM_VOLATILE_P (stmt))) + goto insert_dont_know_node; if (ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS)) continue; - - /* In the GIMPLE representation, a modify expression - contains a single load or store to memory. */ - if (TREE_CODE (TREE_OPERAND (stmt, 0)) == ARRAY_REF) - VARRAY_PUSH_GENERIC_PTR - (*datarefs, analyze_array (stmt, TREE_OPERAND (stmt, 0), - false)); - - else if (TREE_CODE (TREE_OPERAND (stmt, 1)) == ARRAY_REF) - VARRAY_PUSH_GENERIC_PTR - (*datarefs, analyze_array (stmt, TREE_OPERAND (stmt, 1), - true)); - else + + switch (TREE_CODE (stmt)) { - if (dont_know_node_not_inserted) + case MODIFY_EXPR: + if (TREE_CODE (TREE_OPERAND (stmt, 0)) == ARRAY_REF) + VARRAY_PUSH_GENERIC_PTR + (*datarefs, analyze_array (stmt, TREE_OPERAND (stmt, 0), + false)); + + if (TREE_CODE (TREE_OPERAND (stmt, 1)) == ARRAY_REF) + VARRAY_PUSH_GENERIC_PTR + (*datarefs, analyze_array (stmt, TREE_OPERAND (stmt, 1), + true)); + + if (TREE_CODE (TREE_OPERAND (stmt, 0)) != ARRAY_REF + && TREE_CODE (TREE_OPERAND (stmt, 1)) != ARRAY_REF) + goto insert_dont_know_node; + + break; + + case CALL_EXPR: + { + tree args; + bool one_inserted = false; + + for (args = TREE_OPERAND (stmt, 1); args; args = TREE_CHAIN (args)) + if (TREE_CODE (TREE_VALUE (args)) == ARRAY_REF) + { + VARRAY_PUSH_GENERIC_PTR + (*datarefs, analyze_array (stmt, TREE_VALUE (args), true)); + one_inserted = true; + } + + if (!one_inserted) + goto insert_dont_know_node; + + break; + } + + default: { struct data_reference *res; + + insert_dont_know_node:; res = xmalloc (sizeof (struct data_reference)); DR_STMT (res) = NULL_TREE; DR_REF (res) = NULL_TREE; @@ -2262,7 +2294,9 @@ find_data_references_in_loop (struct loop *loop, varray_type *datarefs) DR_BASE_NAME (res) = NULL; DR_IS_READ (res) = false; VARRAY_PUSH_GENERIC_PTR (*datarefs, res); - dont_know_node_not_inserted = false; + + free (bbs); + return chrec_dont_know; } } @@ -2277,7 +2311,7 @@ find_data_references_in_loop (struct loop *loop, varray_type *datarefs) free (bbs); - return dont_know_node_not_inserted ? NULL_TREE : chrec_dont_know; + return NULL_TREE; } |