aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-object-size.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2015-10-26 14:22:20 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2015-10-26 14:22:20 +0000
commit1e080ab4ed3a4390f6e57adb608b91b2c440af36 (patch)
tree7612eb7cb09900d59522c9f603ee66b5da5b0595 /gcc/tree-object-size.c
parent3373589b25382e5389a189acc832fb657016f375 (diff)
downloadgcc-1e080ab4ed3a4390f6e57adb608b91b2c440af36.zip
gcc-1e080ab4ed3a4390f6e57adb608b91b2c440af36.tar.gz
gcc-1e080ab4ed3a4390f6e57adb608b91b2c440af36.tar.bz2
tree-object-size.c: Remove builtins.h include, include tree-cfg.h.
2015-10-26 Richard Biener <rguenther@suse.de> * tree-object-size.c: Remove builtins.h include, include tree-cfg.h. (do_valueize): New function. (pass_object_sizes::execute): Use gimple_fold_stmt_to_constant and replace_uses_by. * tree-ssa-threadedge.c: Remove builtins.h include, include gimple-fold.h (fold_assignment_stmt): Remove. (threadedge_valueize): New function. (record_temporary_equivalences_from_stmts): Use gimple_fold_stmt_to_constant_1, note additional cleanup opportunities. From-SVN: r229364
Diffstat (limited to 'gcc/tree-object-size.c')
-rw-r--r--gcc/tree-object-size.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c
index 230761b..e332d4c 100644
--- a/gcc/tree-object-size.c
+++ b/gcc/tree-object-size.c
@@ -36,7 +36,7 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-iterator.h"
#include "tree-pass.h"
#include "tree-ssa-propagate.h"
-#include "builtins.h"
+#include "tree-cfg.h"
struct object_size_info
{
@@ -1231,6 +1231,14 @@ public:
}; // class pass_object_sizes
+/* Dummy valueize function. */
+
+static tree
+do_valueize (tree t)
+{
+ return t;
+}
+
unsigned int
pass_object_sizes::execute (function *fun)
{
@@ -1287,7 +1295,11 @@ pass_object_sizes::execute (function *fun)
continue;
}
- result = fold_call_stmt (as_a <gcall *> (call), false);
+ tree lhs = gimple_call_lhs (call);
+ if (!lhs)
+ continue;
+
+ result = gimple_fold_stmt_to_constant (call, do_valueize);
if (!result)
{
tree ost = gimple_call_arg (call, 1);
@@ -1318,22 +1330,8 @@ pass_object_sizes::execute (function *fun)
fprintf (dump_file, "\n");
}
- tree lhs = gimple_call_lhs (call);
- if (!lhs)
- continue;
-
/* Propagate into all uses and fold those stmts. */
- gimple *use_stmt;
- imm_use_iterator iter;
- FOR_EACH_IMM_USE_STMT (use_stmt, iter, lhs)
- {
- use_operand_p use_p;
- FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
- SET_USE (use_p, result);
- gimple_stmt_iterator gsi = gsi_for_stmt (use_stmt);
- fold_stmt (&gsi);
- update_stmt (gsi_stmt (gsi));
- }
+ replace_uses_by (lhs, result);
}
}