summaryrefslogtreecommitdiff
path: root/gcc/tree-outof-ssa.c
diff options
context:
space:
mode:
authordnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2005-01-27 04:45:20 +0000
committerdnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2005-01-27 04:45:20 +0000
commitba7236baa534f39ec615795db14885dcd5253094 (patch)
tree839beaf956bc6b73ae54db4610def572b171b9e0 /gcc/tree-outof-ssa.c
parenta607ffb19c99cfa6acf803b51544b334c9f2fef7 (diff)
downloadgcc-ba7236baa534f39ec615795db14885dcd5253094.tar.gz
PR tree-optimization/19633
* tree-ssa-alias.c (ptr_is_dereferenced_by): Also handle CALL_EXPRs. (maybe_create_global_var): Do not create .GLOBAL_VAR if there are no call-clobbered variables. * tree-outof-ssa.c (check_replaceable): Return false for calls with side-effects. testsuite/ChangeLog PR tree-optimization/19633 * gcc.dg/pr19633.c: New test. * gcc.dg/tree-ssa/pr19633.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94311 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-outof-ssa.c')
-rw-r--r--gcc/tree-outof-ssa.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c
index cfa17043ca6..430e8cae58a 100644
--- a/gcc/tree-outof-ssa.c
+++ b/gcc/tree-outof-ssa.c
@@ -1460,6 +1460,7 @@ check_replaceable (temp_expr_table_p tab, tree stmt)
int num_use_ops, version;
var_map map = tab->map;
ssa_op_iter iter;
+ tree call_expr;
if (TREE_CODE (stmt) != MODIFY_EXPR)
return false;
@@ -1486,6 +1487,15 @@ check_replaceable (temp_expr_table_p tab, tree stmt)
if (flag_float_store && FLOAT_TYPE_P (TREE_TYPE (TREE_OPERAND (stmt, 1))))
return false;
+ /* Calls to functions with side-effects cannot be replaced. */
+ if ((call_expr = get_call_expr_in (stmt)) != NULL_TREE)
+ {
+ int call_flags = call_expr_flags (call_expr);
+ if (TREE_SIDE_EFFECTS (call_expr)
+ && !(call_flags & (ECF_PURE | ECF_CONST | ECF_NORETURN)))
+ return false;
+ }
+
uses = USE_OPS (ann);
num_use_ops = NUM_USES (uses);
vuseops = VUSE_OPS (ann);