The following simplifies some gimple_build API use by using the
available gimple_seq overloads.
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.
* tree-switch-conversion.cc (gen_log2): Use gimple_seq
overload of gimple_build.
(gen_pow2p): Likewise.
---
gcc/tree-switch-conversion.cc | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/gcc/tree-switch-conversion.cc b/gcc/tree-switch-conversion.cc
index 6fcb88f3ae0..f3e77647daa 100644
--- a/gcc/tree-switch-conversion.cc
+++ b/gcc/tree-switch-conversion.cc
@@ -117,18 +117,16 @@ static gimple_seq
gen_log2 (tree op, location_t loc, tree *result, tree type)
{
gimple_seq stmts = NULL;
- gimple_stmt_iterator gsi = gsi_last (stmts);
tree orig_type = TREE_TYPE (op);
tree tmp1;
if (type != orig_type)
- tmp1 = gimple_convert (&gsi, false, GSI_NEW_STMT, loc, type, op);
+ tmp1 = gimple_convert (&stmts, loc, type, op);
else
tmp1 = op;
/* Build FFS (op) - 1. */
- tree tmp2 = gimple_build (&gsi, false, GSI_NEW_STMT, loc, IFN_FFS, orig_type,
- tmp1);
- tree tmp3 = gimple_build (&gsi, false, GSI_NEW_STMT, loc, MINUS_EXPR,
+ tree tmp2 = gimple_build (&stmts, loc, IFN_FFS, orig_type, tmp1);
+ tree tmp3 = gimple_build (&stmts, loc, MINUS_EXPR,
orig_type, tmp2, build_one_cst (orig_type));
*result = tmp3;
return stmts;
@@ -143,7 +141,6 @@ static gimple_seq
gen_pow2p (tree op, location_t loc, tree *result)
{
gimple_seq stmts = NULL;
- gimple_stmt_iterator gsi = gsi_last (stmts);
tree type = TREE_TYPE (op);
tree utype = unsigned_type_for (type);
@@ -153,13 +150,11 @@ gen_pow2p (tree op, location_t loc, tree *result)
if (types_compatible_p (type, utype))
tmp1 = op;
else
- tmp1 = gimple_convert (&gsi, false, GSI_NEW_STMT, loc, utype, op);
- tree tmp2 = gimple_build (&gsi, false, GSI_NEW_STMT, loc, MINUS_EXPR, utype,
+ tmp1 = gimple_convert (&stmts, loc, utype, op);
+ tree tmp2 = gimple_build (&stmts, loc, MINUS_EXPR, utype,
tmp1, build_one_cst (utype));
- tree tmp3 = gimple_build (&gsi, false, GSI_NEW_STMT, loc, BIT_XOR_EXPR,
- utype, tmp1, tmp2);
- *result = gimple_build (&gsi, false, GSI_NEW_STMT, loc, GT_EXPR,
- boolean_type_node, tmp3, tmp2);
+ tree tmp3 = gimple_build (&stmts, loc, BIT_XOR_EXPR, utype, tmp1, tmp2);
+ *result = gimple_build (&stmts, loc, GT_EXPR, boolean_type_node, tmp3, tmp2);
return stmts;
}
--
2.51.0