aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2022-05-12 08:24:12 +0200
committerRichard Biener <rguenther@suse.de>2022-05-13 08:18:33 +0200
commitba2068893c37deaa418d9b2126414f6824e66655 (patch)
tree6f095857999bb756f52b23c33747efef96996981
parent90a8eab4a1292430467f68b65e5127f7760acc94 (diff)
downloadgcc-ba2068893c37deaa418d9b2126414f6824e66655.zip
gcc-ba2068893c37deaa418d9b2126414f6824e66655.tar.gz
gcc-ba2068893c37deaa418d9b2126414f6824e66655.tar.bz2
Make gimple_build main workers more flexible
The following makes the main gimple_build API take a gimple_stmt_iterator, whether to insert before or after and an iterator update argument to make it more convenient to use in certain situations (see the tree-vect-generic.cc hunks for an example). It also makes the case we insert into the IL somewhat distinct from inserting into a standalone sequence in that it simplifies built expressions the same way as inserting and calling fold_stmt (..., follow_all_ssa_edges) would. When inserting into a standalone sequence we restrict simplification to defs within the currently building sequence. The patch only amends the tree_code gimple_build API, I will followup with converting the rest as well. The patch got larger than intended because the template forwarders now use gsi_last which introduces a dependency on gimple-iterator.h requiring mass #include re-org across the tree. There are two frontend specific files including gimple-fold.h just for some padding clearing stuff - I've removed the include and instead moved the declarations to fold-const.h (but not the implementations). Otherwise I'd have to include half of the middle-end headers in those files which I didn't much like. 2022-05-12 Richard Biener <rguenther@suse.de> gcc/cp/ * constexpr.cc: Remove gimple-fold.h include. gcc/c-family/ * c-omp.cc: Remove gimple-fold.h include. gcc/analyzer/ * supergraph.cc: Re-order gimple-fold.h include. gcc/ * gimple-fold.cc (gimple_build): Adjust for new main API. * gimple-fold.h (gimple_build): New main APIs with iterator, insert direction and iterator update. (gimple_build): New forwarder template. (clear_padding_type_may_have_padding_p): Remove. (clear_type_padding_in_mask): Likewise. (arith_overflowed_p): Likewise. * fold-const.h (clear_padding_type_may_have_padding_p): Declare. (clear_type_padding_in_mask): Likewise. (arith_overflowed_p): Likewise. * tree-vect-generic.cc (gimplify_build3): Use main gimple_build API. (gimplify_build2): Likewise. (gimplify_build1): Likewise. * ubsan.cc (ubsan_expand_ptr_ifn): Likewise, avoid extra compare stmt. * gengtype.cc (open_base_files): Re-order includes. * builtins.cc: Re-order gimple-fold.h include. * calls.cc: Likewise. * cgraphbuild.cc: Likewise. * cgraphunit.cc: Likewise. * config/rs6000/rs6000-builtin.cc: Likewise. * config/rs6000/rs6000-call.cc: Likewise. * config/rs6000/rs6000.cc: Likewise. * config/s390/s390.cc: Likewise. * expr.cc: Likewise. * fold-const.cc: Likewise. * function-tests.cc: Likewise. * gimple-match-head.cc: Likewise. * gimple-range-fold.cc: Likewise. * gimple-ssa-evrp-analyze.cc: Likewise. * gimple-ssa-evrp.cc: Likewise. * gimple-ssa-sprintf.cc: Likewise. * gimple-ssa-warn-access.cc: Likewise. * gimplify.cc: Likewise. * graphite-isl-ast-to-gimple.cc: Likewise. * ipa-cp.cc: Likewise. * ipa-devirt.cc: Likewise. * ipa-prop.cc: Likewise. * omp-low.cc: Likewise. * pointer-query.cc: Likewise. * range-op.cc: Likewise. * tree-cfg.cc: Likewise. * tree-if-conv.cc: Likewise. * tree-inline.cc: Likewise. * tree-object-size.cc: Likewise. * tree-ssa-ccp.cc: Likewise. * tree-ssa-dom.cc: Likewise. * tree-ssa-forwprop.cc: Likewise. * tree-ssa-ifcombine.cc: Likewise. * tree-ssa-loop-ivcanon.cc: Likewise. * tree-ssa-math-opts.cc: Likewise. * tree-ssa-pre.cc: Likewise. * tree-ssa-propagate.cc: Likewise. * tree-ssa-reassoc.cc: Likewise. * tree-ssa-sccvn.cc: Likewise. * tree-ssa-strlen.cc: Likewise. * tree-ssa.cc: Likewise. * value-pointer-equiv.cc: Likewise. * vr-values.cc: Likewise. gcc/testsuite/ * gcc.dg/plugin/diagnostic_group_plugin.c: Reorder or remove gimple-fold.h include. * gcc.dg/plugin/diagnostic_plugin_show_trees.c: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_inlining.c: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_metadata.c: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_paths.c: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_show_locus.c: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_string_literals.c: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.c: Likewise. * gcc.dg/plugin/finish_unit_plugin.c: Likewise. * gcc.dg/plugin/ggcplug.c: Likewise. * gcc.dg/plugin/must_tail_call_plugin.c: Likewise. * gcc.dg/plugin/one_time_plugin.c: Likewise. * gcc.dg/plugin/selfassign.c: Likewise. * gcc.dg/plugin/start_unit_plugin.c: Likewise. * g++.dg/plugin/selfassign.c: Likewise.
-rw-r--r--gcc/analyzer/supergraph.cc4
-rw-r--r--gcc/builtins.cc2
-rw-r--r--gcc/c-family/c-omp.cc1
-rw-r--r--gcc/calls.cc1
-rw-r--r--gcc/cgraphbuild.cc2
-rw-r--r--gcc/cgraphunit.cc2
-rw-r--r--gcc/config/rs6000/rs6000-builtin.cc2
-rw-r--r--gcc/config/rs6000/rs6000-call.cc2
-rw-r--r--gcc/config/rs6000/rs6000.cc2
-rw-r--r--gcc/config/s390/s390.cc1
-rw-r--r--gcc/cp/constexpr.cc1
-rw-r--r--gcc/expr.cc1
-rw-r--r--gcc/fold-const.cc1
-rw-r--r--gcc/fold-const.h5
-rw-r--r--gcc/function-tests.cc3
-rw-r--r--gcc/gengtype.cc6
-rw-r--r--gcc/gimple-fold.cc93
-rw-r--r--gcc/gimple-fold.h34
-rw-r--r--gcc/gimple-match-head.cc1
-rw-r--r--gcc/gimple-range-fold.cc1
-rw-r--r--gcc/gimple-ssa-evrp-analyze.cc2
-rw-r--r--gcc/gimple-ssa-evrp.cc2
-rw-r--r--gcc/gimple-ssa-sprintf.cc2
-rw-r--r--gcc/gimple-ssa-warn-access.cc2
-rw-r--r--gcc/gimplify.cc2
-rw-r--r--gcc/graphite-isl-ast-to-gimple.cc2
-rw-r--r--gcc/ipa-cp.cc1
-rw-r--r--gcc/ipa-devirt.cc1
-rw-r--r--gcc/ipa-prop.cc2
-rw-r--r--gcc/omp-low.cc2
-rw-r--r--gcc/pointer-query.cc1
-rw-r--r--gcc/range-op.cc2
-rw-r--r--gcc/testsuite/g++.dg/plugin/selfassign.c4
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_group_plugin.c4
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_show_trees.c4
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_inlining.c4
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_metadata.c4
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.c4
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_show_locus.c4
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_string_literals.c4
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.c4
-rw-r--r--gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c1
-rw-r--r--gcc/testsuite/gcc.dg/plugin/ggcplug.c1
-rw-r--r--gcc/testsuite/gcc.dg/plugin/must_tail_call_plugin.c1
-rw-r--r--gcc/testsuite/gcc.dg/plugin/one_time_plugin.c1
-rw-r--r--gcc/testsuite/gcc.dg/plugin/selfassign.c4
-rw-r--r--gcc/testsuite/gcc.dg/plugin/start_unit_plugin.c1
-rw-r--r--gcc/tree-cfg.cc2
-rw-r--r--gcc/tree-if-conv.cc2
-rw-r--r--gcc/tree-inline.cc2
-rw-r--r--gcc/tree-object-size.cc2
-rw-r--r--gcc/tree-ssa-ccp.cc2
-rw-r--r--gcc/tree-ssa-dom.cc2
-rw-r--r--gcc/tree-ssa-forwprop.cc2
-rw-r--r--gcc/tree-ssa-ifcombine.cc2
-rw-r--r--gcc/tree-ssa-loop-ivcanon.cc2
-rw-r--r--gcc/tree-ssa-math-opts.cc2
-rw-r--r--gcc/tree-ssa-pre.cc2
-rw-r--r--gcc/tree-ssa-propagate.cc2
-rw-r--r--gcc/tree-ssa-reassoc.cc2
-rw-r--r--gcc/tree-ssa-sccvn.cc2
-rw-r--r--gcc/tree-ssa-strlen.cc2
-rw-r--r--gcc/tree-ssa.cc2
-rw-r--r--gcc/tree-vect-generic.cc15
-rw-r--r--gcc/ubsan.cc9
-rw-r--r--gcc/value-pointer-equiv.cc2
-rw-r--r--gcc/vr-values.cc2
67 files changed, 180 insertions, 111 deletions
diff --git a/gcc/analyzer/supergraph.cc b/gcc/analyzer/supergraph.cc
index 466f924..f023c53 100644
--- a/gcc/analyzer/supergraph.cc
+++ b/gcc/analyzer/supergraph.cc
@@ -29,13 +29,13 @@ along with GCC; see the file COPYING3. If not see
#include "ggc.h"
#include "basic-block.h"
#include "function.h"
+#include "gimple.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimple-expr.h"
#include "is-a.h"
#include "timevar.h"
-#include "gimple.h"
-#include "gimple-iterator.h"
#include "gimple-pretty-print.h"
#include "tree-pretty-print.h"
#include "graphviz.h"
diff --git a/gcc/builtins.cc b/gcc/builtins.cc
index 5b085e3..5fc89ad 100644
--- a/gcc/builtins.cc
+++ b/gcc/builtins.cc
@@ -67,13 +67,13 @@ along with GCC; see the file COPYING3. If not see
#include "asan.h"
#include "internal-fn.h"
#include "case-cfn-macros.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "intl.h"
#include "file-prefix-map.h" /* remap_macro_filename() */
#include "gomp-constants.h"
#include "omp-general.h"
#include "tree-dfa.h"
-#include "gimple-iterator.h"
#include "gimple-ssa.h"
#include "tree-ssa-live.h"
#include "tree-outof-ssa.h"
diff --git a/gcc/c-family/c-omp.cc b/gcc/c-family/c-omp.cc
index 987ba7d..01ef4ee 100644
--- a/gcc/c-family/c-omp.cc
+++ b/gcc/c-family/c-omp.cc
@@ -36,7 +36,6 @@ along with GCC; see the file COPYING3. If not see
#include "gimplify.h"
#include "langhooks.h"
#include "bitmap.h"
-#include "gimple-fold.h"
/* Complete a #pragma oacc wait construct. LOC is the location of
diff --git a/gcc/calls.cc b/gcc/calls.cc
index 4d0bc45..bbaf69c 100644
--- a/gcc/calls.cc
+++ b/gcc/calls.cc
@@ -55,6 +55,7 @@ along with GCC; see the file COPYING3. If not see
#include "hash-traits.h"
#include "attribs.h"
#include "builtins.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "attr-fnspec.h"
#include "value-query.h"
diff --git a/gcc/cgraphbuild.cc b/gcc/cgraphbuild.cc
index 138484c..fdd17aa 100644
--- a/gcc/cgraphbuild.cc
+++ b/gcc/cgraphbuild.cc
@@ -26,8 +26,8 @@ along with GCC; see the file COPYING3. If not see
#include "gimple.h"
#include "tree-pass.h"
#include "cgraph.h"
-#include "gimple-fold.h"
#include "gimple-iterator.h"
+#include "gimple-fold.h"
#include "gimple-walk.h"
#include "ipa-utils.h"
#include "except.h"
diff --git a/gcc/cgraphunit.cc b/gcc/cgraphunit.cc
index bc3dc75..e77bf97 100644
--- a/gcc/cgraphunit.cc
+++ b/gcc/cgraphunit.cc
@@ -179,9 +179,9 @@ along with GCC; see the file COPYING3. If not see
#include "stor-layout.h"
#include "output.h"
#include "cfgcleanup.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "gimplify.h"
-#include "gimple-iterator.h"
#include "gimplify-me.h"
#include "tree-cfg.h"
#include "tree-into-ssa.h"
diff --git a/gcc/config/rs6000/rs6000-builtin.cc b/gcc/config/rs6000/rs6000-builtin.cc
index e925ba9..b60dde9 100644
--- a/gcc/config/rs6000/rs6000-builtin.cc
+++ b/gcc/config/rs6000/rs6000-builtin.cc
@@ -45,8 +45,8 @@
#include "expr.h"
#include "langhooks.h"
#include "gimplify.h"
-#include "gimple-fold.h"
#include "gimple-iterator.h"
+#include "gimple-fold.h"
#include "ssa.h"
#include "tree-ssa-propagate.h"
#include "builtins.h"
diff --git a/gcc/config/rs6000/rs6000-call.cc b/gcc/config/rs6000/rs6000-call.cc
index f06c692..6011fe8 100644
--- a/gcc/config/rs6000/rs6000-call.cc
+++ b/gcc/config/rs6000/rs6000-call.cc
@@ -55,8 +55,8 @@
#include "common/common-target.h"
#include "langhooks.h"
#include "gimplify.h"
-#include "gimple-fold.h"
#include "gimple-iterator.h"
+#include "gimple-fold.h"
#include "ssa.h"
#include "tree-ssa-propagate.h"
#include "builtins.h"
diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 5cb8a53..d4defc8 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -58,8 +58,8 @@
#include "reload.h"
#include "sched-int.h"
#include "gimplify.h"
-#include "gimple-fold.h"
#include "gimple-iterator.h"
+#include "gimple-fold.h"
#include "gimple-walk.h"
#include "ssa.h"
#include "tree-vectorizer.h"
diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc
index 7c3bd6c..45bbb6c 100644
--- a/gcc/config/s390/s390.cc
+++ b/gcc/config/s390/s390.cc
@@ -70,6 +70,7 @@ along with GCC; see the file COPYING3. If not see
#include "debug.h"
#include "langhooks.h"
#include "internal-fn.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimplify.h"
diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
index e560d84..433fa76 100644
--- a/gcc/cp/constexpr.cc
+++ b/gcc/cp/constexpr.cc
@@ -31,7 +31,6 @@ along with GCC; see the file COPYING3. If not see
#include "builtins.h"
#include "tree-inline.h"
#include "ubsan.h"
-#include "gimple-fold.h"
#include "timevar.h"
#include "fold-const-call.h"
#include "stor-layout.h"
diff --git a/gcc/expr.cc b/gcc/expr.cc
index 5f7142b..1806091 100644
--- a/gcc/expr.cc
+++ b/gcc/expr.cc
@@ -60,6 +60,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-ssa-address.h"
#include "builtins.h"
#include "ccmp.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "rtx-vector-builder.h"
#include "tree-pretty-print.h"
diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc
index a57ad07..7bf1231 100644
--- a/gcc/fold-const.cc
+++ b/gcc/fold-const.cc
@@ -70,6 +70,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-dfa.h"
#include "builtins.h"
#include "generic-match.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-into-ssa.h"
#include "md5.h"
diff --git a/gcc/fold-const.h b/gcc/fold-const.h
index a4ff554..fe78a4d 100644
--- a/gcc/fold-const.h
+++ b/gcc/fold-const.h
@@ -245,6 +245,11 @@ extern tree fold_build_pointer_plus_hwi_loc (location_t loc, tree ptr, HOST_WIDE
#define fold_build_pointer_plus_hwi(p,o) \
fold_build_pointer_plus_hwi_loc (UNKNOWN_LOCATION, p, o)
+/* In gimple-fold.cc. */
+extern void clear_type_padding_in_mask (tree, unsigned char *);
+extern bool clear_padding_type_may_have_padding_p (tree);
+extern bool arith_overflowed_p (enum tree_code, const_tree, const_tree,
+ const_tree);
/* Class used to compare gimple operands. */
diff --git a/gcc/function-tests.cc b/gcc/function-tests.cc
index 7d77615..1f983e8 100644
--- a/gcc/function-tests.cc
+++ b/gcc/function-tests.cc
@@ -47,6 +47,8 @@ along with GCC; see the file COPYING3. If not see
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
+#include "gimple.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "gimple-expr.h"
#include "toplev.h"
@@ -67,7 +69,6 @@ along with GCC; see the file COPYING3. If not see
#include "internal-fn.h"
#include "gimple-expr.h"
#include "is-a.h"
-#include "gimple.h"
#include "tree-pass.h"
#include "context.h"
#include "hash-map.h"
diff --git a/gcc/gengtype.cc b/gcc/gengtype.cc
index e11da9e..1967625 100644
--- a/gcc/gengtype.cc
+++ b/gcc/gengtype.cc
@@ -1703,9 +1703,9 @@ open_base_files (void)
"alias.h", "insn-config.h", "flags.h", "expmed.h", "dojump.h",
"explow.h", "calls.h", "memmodel.h", "emit-rtl.h", "varasm.h",
"stmt.h", "expr.h", "alloc-pool.h", "cselib.h", "insn-addr.h",
- "optabs.h", "libfuncs.h", "debug.h", "internal-fn.h", "gimple-fold.h",
- "value-range.h",
- "tree-eh.h", "gimple-iterator.h", "gimple-ssa.h", "tree-cfg.h",
+ "optabs.h", "libfuncs.h", "debug.h", "internal-fn.h",
+ "gimple-iterator.h", "gimple-fold.h", "value-range.h",
+ "tree-eh.h", "gimple-ssa.h", "tree-cfg.h",
"tree-vrp.h", "tree-phinodes.h", "ssa-iterators.h", "stringpool.h",
"tree-ssanames.h", "tree-ssa-loop.h", "tree-ssa-loop-ivopts.h",
"tree-ssa-loop-manip.h", "tree-ssa-loop-niter.h", "tree-into-ssa.h",
diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc
index 7baec11..e086b03 100644
--- a/gcc/gimple-fold.cc
+++ b/gcc/gimple-fold.cc
@@ -37,9 +37,9 @@ along with GCC; see the file COPYING3. If not see
#include "expr.h"
#include "stor-layout.h"
#include "dumpfile.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "gimplify.h"
-#include "gimple-iterator.h"
#include "tree-into-ssa.h"
#include "tree-dfa.h"
#include "tree-object-size.h"
@@ -8669,14 +8669,23 @@ gimple_build_valueize (tree op)
/* Build the expression CODE OP0 of type TYPE with location LOC,
simplifying it first if possible. Returns the built
- expression value and appends statements possibly defining it
- to SEQ. */
+ expression value and inserts statements possibly defining it
+ before GSI if BEFORE is true or after GSI if false and advance
+ the iterator accordingly.
+ If gsi refers to a basic block simplifying is allowed to look
+ at all SSA defs while when it does not it is restricted to
+ SSA defs that are not associated with a basic block yet,
+ indicating they belong to the currently building sequence. */
tree
-gimple_build (gimple_seq *seq, location_t loc,
- enum tree_code code, tree type, tree op0)
+gimple_build (gimple_stmt_iterator *gsi,
+ bool before, gsi_iterator_update update,
+ location_t loc, enum tree_code code, tree type, tree op0)
{
- tree res = gimple_simplify (code, type, op0, seq, gimple_build_valueize);
+ gimple_seq seq = NULL;
+ tree res
+ = gimple_simplify (code, type, op0, &seq,
+ gsi->bb ? follow_all_ssa_edges : gimple_build_valueize);
if (!res)
{
res = create_tmp_reg_or_ssa_name (type);
@@ -8688,7 +8697,21 @@ gimple_build (gimple_seq *seq, location_t loc,
else
stmt = gimple_build_assign (res, code, op0);
gimple_set_location (stmt, loc);
- gimple_seq_add_stmt_without_update (seq, stmt);
+ gimple_seq_add_stmt_without_update (&seq, stmt);
+ }
+ if (before)
+ {
+ if (gsi->bb)
+ gsi_insert_seq_before (gsi, seq, update);
+ else
+ gsi_insert_seq_before_without_update (gsi, seq, update);
+ }
+ else
+ {
+ if (gsi->bb)
+ gsi_insert_seq_after (gsi, seq, update);
+ else
+ gsi_insert_seq_after_without_update (gsi, seq, update);
}
return res;
}
@@ -8699,16 +8722,35 @@ gimple_build (gimple_seq *seq, location_t loc,
to SEQ. */
tree
-gimple_build (gimple_seq *seq, location_t loc,
- enum tree_code code, tree type, tree op0, tree op1)
+gimple_build (gimple_stmt_iterator *gsi,
+ bool before, gsi_iterator_update update,
+ location_t loc, enum tree_code code, tree type,
+ tree op0, tree op1)
{
- tree res = gimple_simplify (code, type, op0, op1, seq, gimple_build_valueize);
+ gimple_seq seq = NULL;
+ tree res
+ = gimple_simplify (code, type, op0, op1, &seq,
+ gsi->bb ? follow_all_ssa_edges : gimple_build_valueize);
if (!res)
{
res = create_tmp_reg_or_ssa_name (type);
gimple *stmt = gimple_build_assign (res, code, op0, op1);
gimple_set_location (stmt, loc);
- gimple_seq_add_stmt_without_update (seq, stmt);
+ gimple_seq_add_stmt_without_update (&seq, stmt);
+ }
+ if (before)
+ {
+ if (gsi->bb)
+ gsi_insert_seq_before (gsi, seq, update);
+ else
+ gsi_insert_seq_before_without_update (gsi, seq, update);
+ }
+ else
+ {
+ if (gsi->bb)
+ gsi_insert_seq_after (gsi, seq, update);
+ else
+ gsi_insert_seq_after_without_update (gsi, seq, update);
}
return res;
}
@@ -8719,11 +8761,16 @@ gimple_build (gimple_seq *seq, location_t loc,
to SEQ. */
tree
-gimple_build (gimple_seq *seq, location_t loc,
- enum tree_code code, tree type, tree op0, tree op1, tree op2)
+gimple_build (gimple_stmt_iterator *gsi,
+ bool before, gsi_iterator_update update,
+ location_t loc, enum tree_code code, tree type,
+ tree op0, tree op1, tree op2)
{
- tree res = gimple_simplify (code, type, op0, op1, op2,
- seq, gimple_build_valueize);
+
+ gimple_seq seq = NULL;
+ tree res
+ = gimple_simplify (code, type, op0, op1, op2, &seq,
+ gsi->bb ? follow_all_ssa_edges : gimple_build_valueize);
if (!res)
{
res = create_tmp_reg_or_ssa_name (type);
@@ -8734,7 +8781,21 @@ gimple_build (gimple_seq *seq, location_t loc,
else
stmt = gimple_build_assign (res, code, op0, op1, op2);
gimple_set_location (stmt, loc);
- gimple_seq_add_stmt_without_update (seq, stmt);
+ gimple_seq_add_stmt_without_update (&seq, stmt);
+ }
+ if (before)
+ {
+ if (gsi->bb)
+ gsi_insert_seq_before (gsi, seq, update);
+ else
+ gsi_insert_seq_before_without_update (gsi, seq, update);
+ }
+ else
+ {
+ if (gsi->bb)
+ gsi_insert_seq_after (gsi, seq, update);
+ else
+ gsi_insert_seq_after_without_update (gsi, seq, update);
}
return res;
}
diff --git a/gcc/gimple-fold.h b/gcc/gimple-fold.h
index 850f917..520fde8 100644
--- a/gcc/gimple-fold.h
+++ b/gcc/gimple-fold.h
@@ -38,12 +38,8 @@ extern tree maybe_fold_and_comparisons (tree, enum tree_code, tree, tree,
extern tree maybe_fold_or_comparisons (tree, enum tree_code, tree, tree,
enum tree_code, tree, tree,
basic_block = nullptr);
-extern bool clear_padding_type_may_have_padding_p (tree);
-extern void clear_type_padding_in_mask (tree, unsigned char *);
extern bool optimize_atomic_compare_exchange_p (gimple *);
extern void fold_builtin_atomic_compare_exchange (gimple_stmt_iterator *);
-extern bool arith_overflowed_p (enum tree_code, const_tree, const_tree,
- const_tree);
extern tree no_follow_ssa_edges (tree);
extern tree follow_single_use_edges (tree);
extern tree follow_all_ssa_edges (tree);
@@ -71,19 +67,35 @@ extern tree tree_vec_extract (gimple_stmt_iterator *, tree, tree, tree, tree);
/* gimple_build, functionally matching fold_buildN, outputs stmts
int the provided sequence, matching and simplifying them on-the-fly.
Supposed to replace force_gimple_operand (fold_buildN (...), ...). */
-extern tree gimple_build (gimple_seq *, location_t,
- enum tree_code, tree, tree);
-extern tree gimple_build (gimple_seq *, location_t,
- enum tree_code, tree, tree, tree);
-extern tree gimple_build (gimple_seq *, location_t,
- enum tree_code, tree, tree, tree, tree);
+extern tree gimple_build (gimple_stmt_iterator *, bool,
+ enum gsi_iterator_update,
+ location_t, enum tree_code, tree, tree);
+extern tree gimple_build (gimple_stmt_iterator *, bool,
+ enum gsi_iterator_update,
+ location_t, enum tree_code, tree, tree, tree);
+extern tree gimple_build (gimple_stmt_iterator *, bool,
+ enum gsi_iterator_update,
+ location_t, enum tree_code, tree, tree, tree, tree);
+template<class ...Args>
+inline tree
+gimple_build (gimple_seq *seq, location_t loc,
+ enum tree_code code, tree type, Args ...ops)
+{
+ static_assert (sizeof...(ops) > 0 && sizeof...(ops) <= 3,
+ "Number of operands must be from one to three");
+ gimple_stmt_iterator gsi = gsi_last (*seq);
+ return gimple_build (&gsi, false, GSI_CONTINUE_LINKING,
+ loc, code, type, ops...);
+}
template<class ...Args>
inline tree
gimple_build (gimple_seq *seq, enum tree_code code, tree type, Args ...ops)
{
static_assert (sizeof...(ops) > 0 && sizeof...(ops) <= 3,
"Number of operands must be from one to three");
- return gimple_build (seq, UNKNOWN_LOCATION, code, type, ops...);
+ gimple_stmt_iterator gsi = gsi_last (*seq);
+ return gimple_build (&gsi, false, GSI_CONTINUE_LINKING,
+ UNKNOWN_LOCATION, code, type, ops...);
}
extern tree gimple_build (gimple_seq *, location_t, combined_fn, tree);
diff --git a/gcc/gimple-match-head.cc b/gcc/gimple-match-head.cc
index 1c74d38..4c80d77 100644
--- a/gcc/gimple-match-head.cc
+++ b/gcc/gimple-match-head.cc
@@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see
#include "fold-const.h"
#include "fold-const-call.h"
#include "stor-layout.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "calls.h"
#include "tree-dfa.h"
diff --git a/gcc/gimple-range-fold.cc b/gcc/gimple-range-fold.cc
index 3169e29..08d791a 100644
--- a/gcc/gimple-range-fold.cc
+++ b/gcc/gimple-range-fold.cc
@@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. If not see
#include "ssa.h"
#include "gimple-pretty-print.h"
#include "optabs-tree.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "wide-int.h"
#include "fold-const.h"
diff --git a/gcc/gimple-ssa-evrp-analyze.cc b/gcc/gimple-ssa-evrp-analyze.cc
index fec6e87..16e5a75 100644
--- a/gcc/gimple-ssa-evrp-analyze.cc
+++ b/gcc/gimple-ssa-evrp-analyze.cc
@@ -27,9 +27,9 @@ along with GCC; see the file COPYING3. If not see
#include "ssa.h"
#include "gimple-pretty-print.h"
#include "cfganal.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
-#include "gimple-iterator.h"
#include "tree-cfg.h"
#include "tree-ssa-loop-manip.h"
#include "tree-ssa-loop.h"
diff --git a/gcc/gimple-ssa-evrp.cc b/gcc/gimple-ssa-evrp.cc
index 2baaed6..92dbdd5 100644
--- a/gcc/gimple-ssa-evrp.cc
+++ b/gcc/gimple-ssa-evrp.cc
@@ -27,9 +27,9 @@ along with GCC; see the file COPYING3. If not see
#include "ssa.h"
#include "gimple-pretty-print.h"
#include "cfganal.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
-#include "gimple-iterator.h"
#include "tree-cfg.h"
#include "tree-ssa-loop-manip.h"
#include "tree-ssa-loop.h"
diff --git a/gcc/gimple-ssa-sprintf.cc b/gcc/gimple-ssa-sprintf.cc
index 9a84fff..961c1b7 100644
--- a/gcc/gimple-ssa-sprintf.cc
+++ b/gcc/gimple-ssa-sprintf.cc
@@ -53,11 +53,11 @@ along with GCC; see the file COPYING3. If not see
#include "gimple.h"
#include "tree-pass.h"
#include "ssa.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "gimple-pretty-print.h"
#include "diagnostic-core.h"
#include "fold-const.h"
-#include "gimple-iterator.h"
#include "tree-ssa.h"
#include "tree-object-size.h"
#include "tree-cfg.h"
diff --git a/gcc/gimple-ssa-warn-access.cc b/gcc/gimple-ssa-warn-access.cc
index 39aa818..c420424 100644
--- a/gcc/gimple-ssa-warn-access.cc
+++ b/gcc/gimple-ssa-warn-access.cc
@@ -36,8 +36,8 @@
#include "gimple-ssa-warn-restrict.h"
#include "diagnostic-core.h"
#include "fold-const.h"
-#include "gimple-fold.h"
#include "gimple-iterator.h"
+#include "gimple-fold.h"
#include "langhooks.h"
#include "memmodel.h"
#include "target.h"
diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc
index 13413d0..2f6d995 100644
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -42,10 +42,10 @@ along with GCC; see the file COPYING3. If not see
#include "varasm.h"
#include "stmt.h"
#include "expr.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimplify.h"
-#include "gimple-iterator.h"
#include "stor-layout.h"
#include "print-tree.h"
#include "tree-iterator.h"
diff --git a/gcc/graphite-isl-ast-to-gimple.cc b/gcc/graphite-isl-ast-to-gimple.cc
index ea1129f..45ed770 100644
--- a/gcc/graphite-isl-ast-to-gimple.cc
+++ b/gcc/graphite-isl-ast-to-gimple.cc
@@ -32,8 +32,8 @@ along with GCC; see the file COPYING3. If not see
#include "gimple.h"
#include "ssa.h"
#include "fold-const.h"
-#include "gimple-fold.h"
#include "gimple-iterator.h"
+#include "gimple-fold.h"
#include "gimplify.h"
#include "gimplify-me.h"
#include "tree-eh.h"
diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc
index 11f4a32..152fe72 100644
--- a/gcc/ipa-cp.cc
+++ b/gcc/ipa-cp.cc
@@ -113,6 +113,7 @@ along with GCC; see the file COPYING3. If not see
#include "cgraph.h"
#include "diagnostic.h"
#include "fold-const.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "symbol-summary.h"
#include "tree-vrp.h"
diff --git a/gcc/ipa-devirt.cc b/gcc/ipa-devirt.cc
index 6cba208..9f1442d 100644
--- a/gcc/ipa-devirt.cc
+++ b/gcc/ipa-devirt.cc
@@ -120,6 +120,7 @@ along with GCC; see the file COPYING3. If not see
#include "print-tree.h"
#include "calls.h"
#include "ipa-utils.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "symbol-summary.h"
#include "tree-vrp.h"
diff --git a/gcc/ipa-prop.cc b/gcc/ipa-prop.cc
index 80e67e9..c6c745f 100644
--- a/gcc/ipa-prop.cc
+++ b/gcc/ipa-prop.cc
@@ -31,13 +31,13 @@ along with GCC; see the file COPYING3. If not see
#include "cgraph.h"
#include "diagnostic.h"
#include "fold-const.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "calls.h"
#include "stor-layout.h"
#include "print-tree.h"
#include "gimplify.h"
-#include "gimple-iterator.h"
#include "gimplify-me.h"
#include "gimple-walk.h"
#include "symbol-summary.h"
diff --git a/gcc/omp-low.cc b/gcc/omp-low.cc
index e7818a9..8aebaee 100644
--- a/gcc/omp-low.cc
+++ b/gcc/omp-low.cc
@@ -37,9 +37,9 @@ along with GCC; see the file COPYING3. If not see
#include "fold-const.h"
#include "stor-layout.h"
#include "internal-fn.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "gimplify.h"
-#include "gimple-iterator.h"
#include "gimplify-me.h"
#include "gimple-walk.h"
#include "tree-iterator.h"
diff --git a/gcc/pointer-query.cc b/gcc/pointer-query.cc
index d93657f..646606e 100644
--- a/gcc/pointer-query.cc
+++ b/gcc/pointer-query.cc
@@ -33,6 +33,7 @@
#include "langhooks.h"
#include "stringpool.h"
#include "attribs.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "gimple-ssa.h"
#include "intl.h"
diff --git a/gcc/range-op.cc b/gcc/range-op.cc
index 47c6dff..eaa0230 100644
--- a/gcc/range-op.cc
+++ b/gcc/range-op.cc
@@ -38,9 +38,9 @@ along with GCC; see the file COPYING3. If not see
#include "stor-layout.h"
#include "calls.h"
#include "cfganal.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
-#include "gimple-iterator.h"
#include "gimple-walk.h"
#include "tree-cfg.h"
#include "wide-int.h"
diff --git a/gcc/testsuite/g++.dg/plugin/selfassign.c b/gcc/testsuite/g++.dg/plugin/selfassign.c
index 2c60c18..fd78f57 100644
--- a/gcc/testsuite/g++.dg/plugin/selfassign.c
+++ b/gcc/testsuite/g++.dg/plugin/selfassign.c
@@ -17,12 +17,12 @@
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
+#include "gimple.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimple-expr.h"
#include "is-a.h"
-#include "gimple.h"
-#include "gimple-iterator.h"
#include "tree.h"
#include "tree-pass.h"
#include "intl.h"
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_group_plugin.c b/gcc/testsuite/gcc.dg/plugin/diagnostic_group_plugin.c
index 67ca701..3396b38 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_group_plugin.c
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_group_plugin.c
@@ -15,12 +15,12 @@
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
+#include "gimple.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimple-expr.h"
#include "is-a.h"
-#include "gimple.h"
-#include "gimple-iterator.h"
#include "tree.h"
#include "tree-pass.h"
#include "intl.h"
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_show_trees.c b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_show_trees.c
index ac72503..d81fa57 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_show_trees.c
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_show_trees.c
@@ -17,12 +17,12 @@
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
+#include "gimple.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimple-expr.h"
#include "is-a.h"
-#include "gimple.h"
-#include "gimple-iterator.h"
#include "tree.h"
#include "tree-pass.h"
#include "intl.h"
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_inlining.c b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_inlining.c
index d2bfca0..3627f7a 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_inlining.c
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_inlining.c
@@ -15,12 +15,12 @@
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
+#include "gimple.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimple-expr.h"
#include "is-a.h"
-#include "gimple.h"
-#include "gimple-iterator.h"
#include "tree.h"
#include "tree-pass.h"
#include "intl.h"
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_metadata.c b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_metadata.c
index a610891..4b13afc 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_metadata.c
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_metadata.c
@@ -15,12 +15,12 @@
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
+#include "gimple.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimple-expr.h"
#include "is-a.h"
-#include "gimple.h"
-#include "gimple-iterator.h"
#include "tree.h"
#include "tree-pass.h"
#include "intl.h"
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.c b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.c
index 5c2da02..8d97fe8 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.c
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.c
@@ -21,12 +21,12 @@
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
+#include "gimple.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimple-expr.h"
#include "is-a.h"
-#include "gimple.h"
-#include "gimple-iterator.h"
#include "tree.h"
#include "tree-pass.h"
#include "intl.h"
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_show_locus.c b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_show_locus.c
index 482dbda..baa6b62 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_show_locus.c
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_show_locus.c
@@ -47,12 +47,12 @@
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
+#include "gimple.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimple-expr.h"
#include "is-a.h"
-#include "gimple.h"
-#include "gimple-iterator.h"
#include "tree.h"
#include "tree-pass.h"
#include "intl.h"
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_string_literals.c b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_string_literals.c
index aa73dca..0269f72 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_string_literals.c
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_string_literals.c
@@ -17,12 +17,12 @@
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
+#include "gimple.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimple-expr.h"
#include "is-a.h"
-#include "gimple.h"
-#include "gimple-iterator.h"
#include "tree.h"
#include "tree-pass.h"
#include "intl.h"
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.c b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.c
index 4a89d84..f546863 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.c
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.c
@@ -17,12 +17,12 @@
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
+#include "gimple.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimple-expr.h"
#include "is-a.h"
-#include "gimple.h"
-#include "gimple-iterator.h"
#include "tree.h"
#include "tree-pass.h"
#include "intl.h"
diff --git a/gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c b/gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c
index 1b4f7cc..05e1881 100644
--- a/gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c
+++ b/gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c
@@ -15,7 +15,6 @@
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
-#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimple-expr.h"
#include "is-a.h"
diff --git a/gcc/testsuite/gcc.dg/plugin/ggcplug.c b/gcc/testsuite/gcc.dg/plugin/ggcplug.c
index c186d11..a75eed0 100644
--- a/gcc/testsuite/gcc.dg/plugin/ggcplug.c
+++ b/gcc/testsuite/gcc.dg/plugin/ggcplug.c
@@ -14,7 +14,6 @@
#include "ggc.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
-#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimple-expr.h"
#include "is-a.h"
diff --git a/gcc/testsuite/gcc.dg/plugin/must_tail_call_plugin.c b/gcc/testsuite/gcc.dg/plugin/must_tail_call_plugin.c
index 5294f28..0c040e5 100644
--- a/gcc/testsuite/gcc.dg/plugin/must_tail_call_plugin.c
+++ b/gcc/testsuite/gcc.dg/plugin/must_tail_call_plugin.c
@@ -17,7 +17,6 @@
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
-#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimple-expr.h"
#include "is-a.h"
diff --git a/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c b/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
index bd1c0f0..84f2d31 100644
--- a/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
+++ b/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
@@ -12,7 +12,6 @@
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
-#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimple-expr.h"
#include "is-a.h"
diff --git a/gcc/testsuite/gcc.dg/plugin/selfassign.c b/gcc/testsuite/gcc.dg/plugin/selfassign.c
index 2adb644..13b3eca 100644
--- a/gcc/testsuite/gcc.dg/plugin/selfassign.c
+++ b/gcc/testsuite/gcc.dg/plugin/selfassign.c
@@ -17,12 +17,12 @@
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
+#include "gimple.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimple-expr.h"
#include "is-a.h"
-#include "gimple.h"
-#include "gimple-iterator.h"
#include "tree.h"
#include "tree-pass.h"
#include "intl.h"
diff --git a/gcc/testsuite/gcc.dg/plugin/start_unit_plugin.c b/gcc/testsuite/gcc.dg/plugin/start_unit_plugin.c
index 61e9494..7b4f40e 100644
--- a/gcc/testsuite/gcc.dg/plugin/start_unit_plugin.c
+++ b/gcc/testsuite/gcc.dg/plugin/start_unit_plugin.c
@@ -20,7 +20,6 @@
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
-#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimple-expr.h"
#include "is-a.h"
diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc
index e321d92..19ba09f 100644
--- a/gcc/tree-cfg.cc
+++ b/gcc/tree-cfg.cc
@@ -37,9 +37,9 @@ along with GCC; see the file COPYING3. If not see
#include "stor-layout.h"
#include "print-tree.h"
#include "cfganal.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
-#include "gimple-iterator.h"
#include "gimplify-me.h"
#include "gimple-walk.h"
#include "tree-cfg.h"
diff --git a/gcc/tree-if-conv.cc b/gcc/tree-if-conv.cc
index 57cc385..4531ca5 100644
--- a/gcc/tree-if-conv.cc
+++ b/gcc/tree-if-conv.cc
@@ -96,9 +96,9 @@ along with GCC; see the file COPYING3. If not see
#include "alias.h"
#include "fold-const.h"
#include "stor-layout.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "gimplify.h"
-#include "gimple-iterator.h"
#include "gimplify-me.h"
#include "tree-cfg.h"
#include "tree-into-ssa.h"
diff --git a/gcc/tree-inline.cc b/gcc/tree-inline.cc
index 29bb758..043e1d5 100644
--- a/gcc/tree-inline.cc
+++ b/gcc/tree-inline.cc
@@ -41,10 +41,10 @@ along with GCC; see the file COPYING3. If not see
#include "cfganal.h"
#include "tree-iterator.h"
#include "intl.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimplify.h"
-#include "gimple-iterator.h"
#include "gimplify-me.h"
#include "gimple-walk.h"
#include "tree-cfg.h"
diff --git a/gcc/tree-object-size.cc b/gcc/tree-object-size.cc
index fc062b9..5ca87ae 100644
--- a/gcc/tree-object-size.cc
+++ b/gcc/tree-object-size.cc
@@ -29,8 +29,8 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-pretty-print.h"
#include "fold-const.h"
#include "tree-object-size.h"
-#include "gimple-fold.h"
#include "gimple-iterator.h"
+#include "gimple-fold.h"
#include "tree-cfg.h"
#include "tree-dfa.h"
#include "stringpool.h"
diff --git a/gcc/tree-ssa-ccp.cc b/gcc/tree-ssa-ccp.cc
index 9164efe..262a247e 100644
--- a/gcc/tree-ssa-ccp.cc
+++ b/gcc/tree-ssa-ccp.cc
@@ -129,10 +129,10 @@ along with GCC; see the file COPYING3. If not see
#include "ssa.h"
#include "gimple-pretty-print.h"
#include "fold-const.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimplify.h"
-#include "gimple-iterator.h"
#include "tree-cfg.h"
#include "tree-ssa-propagate.h"
#include "dbgcnt.h"
diff --git a/gcc/tree-ssa-dom.cc b/gcc/tree-ssa-dom.cc
index 89b0517..9a84321 100644
--- a/gcc/tree-ssa-dom.cc
+++ b/gcc/tree-ssa-dom.cc
@@ -30,10 +30,10 @@ along with GCC; see the file COPYING3. If not see
#include "fold-const.h"
#include "cfganal.h"
#include "cfgloop.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "tree-inline.h"
-#include "gimple-iterator.h"
#include "tree-cfg.h"
#include "tree-into-ssa.h"
#include "domwalk.h"
diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc
index c5b2a4f..48cab58 100644
--- a/gcc/tree-ssa-forwprop.cc
+++ b/gcc/tree-ssa-forwprop.cc
@@ -32,10 +32,10 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-pretty-print.h"
#include "fold-const.h"
#include "stor-layout.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimplify.h"
-#include "gimple-iterator.h"
#include "gimplify-me.h"
#include "tree-cfg.h"
#include "expr.h"
diff --git a/gcc/tree-ssa-ifcombine.cc b/gcc/tree-ssa-ifcombine.cc
index cb86cc1..88a9f06 100644
--- a/gcc/tree-ssa-ifcombine.cc
+++ b/gcc/tree-ssa-ifcombine.cc
@@ -35,8 +35,8 @@ along with GCC; see the file COPYING3. If not see
BRANCH_COST. */
#include "fold-const.h"
#include "cfganal.h"
-#include "gimple-fold.h"
#include "gimple-iterator.h"
+#include "gimple-fold.h"
#include "gimplify-me.h"
#include "tree-cfg.h"
#include "tree-ssa.h"
diff --git a/gcc/tree-ssa-loop-ivcanon.cc b/gcc/tree-ssa-loop-ivcanon.cc
index e2ac204..2ee00a3 100644
--- a/gcc/tree-ssa-loop-ivcanon.cc
+++ b/gcc/tree-ssa-loop-ivcanon.cc
@@ -48,9 +48,9 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-pretty-print.h"
#include "fold-const.h"
#include "profile.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
-#include "gimple-iterator.h"
#include "tree-cfg.h"
#include "tree-ssa-loop-manip.h"
#include "tree-ssa-loop-niter.h"
diff --git a/gcc/tree-ssa-math-opts.cc b/gcc/tree-ssa-math-opts.cc
index 2085597..ce1df01 100644
--- a/gcc/tree-ssa-math-opts.cc
+++ b/gcc/tree-ssa-math-opts.cc
@@ -100,8 +100,8 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-pretty-print.h"
#include "alias.h"
#include "fold-const.h"
-#include "gimple-fold.h"
#include "gimple-iterator.h"
+#include "gimple-fold.h"
#include "gimplify.h"
#include "gimplify-me.h"
#include "stor-layout.h"
diff --git a/gcc/tree-ssa-pre.cc b/gcc/tree-ssa-pre.cc
index a578ce6..34d77f1 100644
--- a/gcc/tree-ssa-pre.cc
+++ b/gcc/tree-ssa-pre.cc
@@ -34,10 +34,10 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-pretty-print.h"
#include "fold-const.h"
#include "cfganal.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimplify.h"
-#include "gimple-iterator.h"
#include "tree-cfg.h"
#include "tree-into-ssa.h"
#include "tree-dfa.h"
diff --git a/gcc/tree-ssa-propagate.cc b/gcc/tree-ssa-propagate.cc
index 7813e51..c10ffd9 100644
--- a/gcc/tree-ssa-propagate.cc
+++ b/gcc/tree-ssa-propagate.cc
@@ -27,10 +27,10 @@
#include "ssa.h"
#include "gimple-pretty-print.h"
#include "dumpfile.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimplify.h"
-#include "gimple-iterator.h"
#include "tree-cfg.h"
#include "tree-ssa.h"
#include "tree-ssa-propagate.h"
diff --git a/gcc/tree-ssa-reassoc.cc b/gcc/tree-ssa-reassoc.cc
index 43b2537..406523b 100644
--- a/gcc/tree-ssa-reassoc.cc
+++ b/gcc/tree-ssa-reassoc.cc
@@ -38,9 +38,9 @@ along with GCC; see the file COPYING3. If not see
#include "fold-const.h"
#include "stor-layout.h"
#include "cfganal.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
-#include "gimple-iterator.h"
#include "gimplify-me.h"
#include "tree-cfg.h"
#include "tree-ssa-loop.h"
diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc
index f1bc372..ed68557 100644
--- a/gcc/tree-ssa-sccvn.cc
+++ b/gcc/tree-ssa-sccvn.cc
@@ -39,6 +39,7 @@ along with GCC; see the file COPYING3. If not see
#include "cfganal.h"
#include "tree-inline.h"
#include "internal-fn.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimplify.h"
@@ -56,7 +57,6 @@ along with GCC; see the file COPYING3. If not see
#include "tree-ssa-propagate.h"
#include "tree-cfg.h"
#include "domwalk.h"
-#include "gimple-iterator.h"
#include "gimple-match.h"
#include "stringpool.h"
#include "attribs.h"
diff --git a/gcc/tree-ssa-strlen.cc b/gcc/tree-ssa-strlen.cc
index 1e5f911..bb7fe08 100644
--- a/gcc/tree-ssa-strlen.cc
+++ b/gcc/tree-ssa-strlen.cc
@@ -34,10 +34,10 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-ssa-warn-restrict.h"
#include "fold-const.h"
#include "stor-layout.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimplify.h"
-#include "gimple-iterator.h"
#include "gimplify-me.h"
#include "expr.h"
#include "tree-cfg.h"
diff --git a/gcc/tree-ssa.cc b/gcc/tree-ssa.cc
index a362a0a..6507348 100644
--- a/gcc/tree-ssa.cc
+++ b/gcc/tree-ssa.cc
@@ -30,9 +30,9 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic-core.h"
#include "fold-const.h"
#include "stor-layout.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "gimplify.h"
-#include "gimple-iterator.h"
#include "gimple-walk.h"
#include "tree-ssa-loop-manip.h"
#include "tree-into-ssa.h"
diff --git a/gcc/tree-vect-generic.cc b/gcc/tree-vect-generic.cc
index e5bd9dc..d99e320 100644
--- a/gcc/tree-vect-generic.cc
+++ b/gcc/tree-vect-generic.cc
@@ -54,10 +54,7 @@ gimplify_build3 (gimple_stmt_iterator *gsi, enum tree_code code,
tree type, tree a, tree b, tree c)
{
location_t loc = gimple_location (gsi_stmt (*gsi));
- gimple_seq stmts = NULL;
- tree ret = gimple_build (&stmts, loc, code, type, a, b, c);
- gsi_insert_seq_before (gsi, stmts, GSI_SAME_STMT);
- return ret;
+ return gimple_build (gsi, true, GSI_SAME_STMT, loc, code, type, a, b, c);
}
/* Build a binary operation and gimplify it. Emit code before GSI.
@@ -68,10 +65,7 @@ gimplify_build2 (gimple_stmt_iterator *gsi, enum tree_code code,
tree type, tree a, tree b)
{
location_t loc = gimple_location (gsi_stmt (*gsi));
- gimple_seq stmts = NULL;
- tree ret = gimple_build (&stmts, loc, code, type, a, b);
- gsi_insert_seq_before (gsi, stmts, GSI_SAME_STMT);
- return ret;
+ return gimple_build (gsi, true, GSI_SAME_STMT, loc, code, type, a, b);
}
/* Build a unary operation and gimplify it. Emit code before GSI.
@@ -82,10 +76,7 @@ gimplify_build1 (gimple_stmt_iterator *gsi, enum tree_code code, tree type,
tree a)
{
location_t loc = gimple_location (gsi_stmt (*gsi));
- gimple_seq stmts = NULL;
- tree ret = gimple_build (&stmts, loc, code, type, a);
- gsi_insert_seq_before (gsi, stmts, GSI_SAME_STMT);
- return ret;
+ return gimple_build (gsi, true, GSI_SAME_STMT, loc, code, type, a);
}
diff --git a/gcc/ubsan.cc b/gcc/ubsan.cc
index f74929d..6c05814 100644
--- a/gcc/ubsan.cc
+++ b/gcc/ubsan.cc
@@ -1184,12 +1184,9 @@ ubsan_expand_ptr_ifn (gimple_stmt_iterator *gsip)
gimple_set_location (g, loc);
gsi_insert_after (&gsi2, g, GSI_NEW_STMT);
- gimple_seq seq = NULL;
- tree t = gimple_build (&seq, loc, NOP_EXPR, ssizetype, off);
- t = gimple_build (&seq, loc, GE_EXPR, boolean_type_node,
- t, ssize_int (0));
- gsi_insert_seq_before (&gsi, seq, GSI_SAME_STMT);
- g = gimple_build_cond (NE_EXPR, t, boolean_false_node,
+ tree t = gimple_build (&gsi, true, GSI_SAME_STMT,
+ loc, NOP_EXPR, ssizetype, off);
+ g = gimple_build_cond (GE_EXPR, t, ssize_int (0),
NULL_TREE, NULL_TREE);
}
gimple_set_location (g, loc);
diff --git a/gcc/value-pointer-equiv.cc b/gcc/value-pointer-equiv.cc
index f2d95c4..b768ecd 100644
--- a/gcc/value-pointer-equiv.cc
+++ b/gcc/value-pointer-equiv.cc
@@ -28,9 +28,9 @@ along with GCC; see the file COPYING3. If not see
#include "ssa.h"
#include "gimple-pretty-print.h"
#include "cfganal.h"
+#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
-#include "gimple-iterator.h"
#include "tree-cfg.h"
#include "tree-ssa-loop-manip.h"
#include "tree-ssa-loop.h"
diff --git a/gcc/vr-values.cc b/gcc/vr-values.cc
index 301996d..2cc5084 100644
--- a/gcc/vr-values.cc
+++ b/gcc/vr-values.cc
@@ -32,8 +32,8 @@ along with GCC; see the file COPYING3. If not see
#include "fold-const.h"
#include "calls.h"
#include "cfganal.h"
-#include "gimple-fold.h"
#include "gimple-iterator.h"
+#include "gimple-fold.h"
#include "tree-cfg.h"
#include "tree-ssa-loop-niter.h"
#include "tree-ssa-loop.h"