From a4f5959666ea4d2a88c118611d854669b4df4510 Mon Sep 17 00:00:00 2001 From: miyuki Date: Mon, 22 Jun 2015 02:54:11 +0000 Subject: Use std::swap instead of manual swaps. gcc/ * auto-inc-dec.c (reverse_mem, reverse_inc): Remove. (parse_add_or_inc): Use std::swap instead of reverse_{mem,inc}. (find_inc): Likewise. * combine.c (combine_simplify_rtx): Use std::swap instead of manually swapping. * df-core.c (df_worklist_dataflow_doublequeue): Likewise. * df-scan.c (df_swap_refs): Remove. (df_sort_and_compress_refs): Use std::swap instead of df_swap_refs. * dominance.c (link_roots): Use std::swap instead of manually swapping. * expr.c (expand_expr_real_2, do_store_flag): Likewise. * fold-const.c (fold_relational_const): Likewise. * genattrtab.c (simplify_test_exp): Likewise. * gimple-match-head.c (gimple_resimplify2, gimple_resimplify3, gimple_simplify): Likewise. * ifcvt.c (noce_try_abs, find_if_header): Likewise. * internal-fn.c (expand_addsub_overflow, expand_mul_overflow): Likewise. * ipa-devirt.c (add_type_duplicate): Likewise. * loop-iv.c (get_biv_step_1, iv_number_of_iterations): Likewise. * lra-lives.c (lra_setup_reload_pseudo_preferenced_hard_reg): Likewise. * lra.c (lra_create_copy): Likewise. * lto-streamer-out.c (DFS::DFS): Likewise. * modulo-sched.c (get_sched_window): Likewise. * omega.c (omega_pretty_print_problem): Likewise. * optabs.c (prepare_float_lib_cmp, expand_mult_highpart): Likewise. * reload1.c (reloads_unique_chain_p): Likewise. * sel-sched-ir.c (exchange_lv_sets, exchange_av_sets): Remove. (exchange_data_sets): Move logic from exchange_{av,lv}_sets here and use std::swap. * simplify-rtx.c (simplify_unary_operation_1): Use std::swap instead of manually swapping. * tree-if-conv.c (is_cond_scalar_reduction, predicate_scalar_phi, predicate_mem_writes): Likewise. * tree-loop-distribution.c (pg_add_dependence_edges): Likewise. * tree-predcom.c (combine_chains): Likewise. * tree-ssa-alias.c (nonoverlapping_component_refs_p, refs_may_alias_p_1): Likewise. * tree-ssa-ifcombine.c (recognize_if_then_else): Likewise. * tree-ssa-loop-ivopts.c (extract_cond_operands): Likewise. * tree-ssa-loop-niter.c (refine_bounds_using_guard, number_of_iterations_cond): Likewise. * tree-ssa-phiopt.c (tree_ssa_phiopt_worker): Likewise. * tree-ssa-sccvn.c (vn_nary_op_compute_hash): Likewise. * tree-vect-slp.c (vect_build_slp_tree): Likewise. * tree-vect-stmts.c (supportable_widening_operation): Likewise. * tree-vrp.c (extract_range_from_binary_expr_1, extract_range_from_unary_expr_1): Likewise. gcc/cp/ * pt.c (maybe_adjust_types_for_deduction): Use std::swap instead of manually swapping. * semantics.c (finish_omp_atomic): Likewise. * typeck.c (cp_build_array_ref): Likewise. gcc/c-family/ * c-common.c (scalar_to_vector): Use std::swap instead of manually swapping. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@224718 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 49 ++++++++++++++++++++++++++++++++++++++++++++ gcc/auto-inc-dec.c | 34 ++++++------------------------ gcc/c-family/ChangeLog | 5 +++++ gcc/c-family/c-common.c | 6 ++---- gcc/combine.c | 6 +----- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/pt.c | 14 +++++-------- gcc/cp/semantics.c | 4 +--- gcc/cp/typeck.c | 6 +----- gcc/df-core.c | 5 +---- gcc/df-scan.c | 10 +-------- gcc/dominance.c | 6 +----- gcc/expr.c | 21 ++++--------------- gcc/fold-const.c | 4 +--- gcc/genattrtab.c | 6 +----- gcc/gimple-match-head.c | 18 ++++------------ gcc/ifcvt.c | 10 +++------ gcc/internal-fn.c | 40 ++++++++++-------------------------- gcc/ipa-devirt.c | 7 +------ gcc/loop-iv.c | 10 ++++----- gcc/lra-lives.c | 14 ++++--------- gcc/lra.c | 5 +---- gcc/lto-streamer-out.c | 7 ++----- gcc/modulo-sched.c | 4 +--- gcc/omega.c | 6 +----- gcc/optabs.c | 9 ++------ gcc/reload1.c | 6 +----- gcc/sel-sched-ir.c | 48 +++++++------------------------------------ gcc/simplify-rtx.c | 5 +---- gcc/tree-if-conv.c | 24 ++++------------------ gcc/tree-loop-distribution.c | 8 ++------ gcc/tree-predcom.c | 6 +----- gcc/tree-ssa-alias.c | 23 ++++++--------------- gcc/tree-ssa-ifcombine.c | 6 +----- gcc/tree-ssa-loop-ivopts.c | 8 ++++---- gcc/tree-ssa-loop-niter.c | 10 ++++----- gcc/tree-ssa-phiopt.c | 8 ++------ gcc/tree-ssa-sccvn.c | 6 +----- gcc/tree-vect-slp.c | 5 ++--- gcc/tree-vect-stmts.c | 6 +----- gcc/tree-vrp.c | 30 +++++---------------------- 41 files changed, 162 insertions(+), 350 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2b5568504d9..737178ca0ca 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,52 @@ +2015-06-22 Mikhail Maltsev + + * auto-inc-dec.c (reverse_mem, reverse_inc): Remove. + (parse_add_or_inc): Use std::swap instead of reverse_{mem,inc}. + (find_inc): Likewise. + * combine.c (combine_simplify_rtx): Use std::swap instead of manually + swapping. + * df-core.c (df_worklist_dataflow_doublequeue): Likewise. + * df-scan.c (df_swap_refs): Remove. + (df_sort_and_compress_refs): Use std::swap instead of df_swap_refs. + * dominance.c (link_roots): Use std::swap instead of manually swapping. + * expr.c (expand_expr_real_2, do_store_flag): Likewise. + * fold-const.c (fold_relational_const): Likewise. + * genattrtab.c (simplify_test_exp): Likewise. + * gimple-match-head.c (gimple_resimplify2, gimple_resimplify3, + gimple_simplify): Likewise. + * ifcvt.c (noce_try_abs, find_if_header): Likewise. + * internal-fn.c (expand_addsub_overflow, expand_mul_overflow): Likewise. + * ipa-devirt.c (add_type_duplicate): Likewise. + * loop-iv.c (get_biv_step_1, iv_number_of_iterations): Likewise. + * lra-lives.c (lra_setup_reload_pseudo_preferenced_hard_reg): Likewise. + * lra.c (lra_create_copy): Likewise. + * lto-streamer-out.c (DFS::DFS): Likewise. + * modulo-sched.c (get_sched_window): Likewise. + * omega.c (omega_pretty_print_problem): Likewise. + * optabs.c (prepare_float_lib_cmp, expand_mult_highpart): Likewise. + * reload1.c (reloads_unique_chain_p): Likewise. + * sel-sched-ir.c (exchange_lv_sets, exchange_av_sets): Remove. + (exchange_data_sets): Move logic from exchange_{av,lv}_sets here and + use std::swap. + * simplify-rtx.c (simplify_unary_operation_1): Use std::swap instead of + manually swapping. + * tree-if-conv.c (is_cond_scalar_reduction, predicate_scalar_phi, + predicate_mem_writes): Likewise. + * tree-loop-distribution.c (pg_add_dependence_edges): Likewise. + * tree-predcom.c (combine_chains): Likewise. + * tree-ssa-alias.c (nonoverlapping_component_refs_p, + refs_may_alias_p_1): Likewise. + * tree-ssa-ifcombine.c (recognize_if_then_else): Likewise. + * tree-ssa-loop-ivopts.c (extract_cond_operands): Likewise. + * tree-ssa-loop-niter.c (refine_bounds_using_guard, + number_of_iterations_cond): Likewise. + * tree-ssa-phiopt.c (tree_ssa_phiopt_worker): Likewise. + * tree-ssa-sccvn.c (vn_nary_op_compute_hash): Likewise. + * tree-vect-slp.c (vect_build_slp_tree): Likewise. + * tree-vect-stmts.c (supportable_widening_operation): Likewise. + * tree-vrp.c (extract_range_from_binary_expr_1, + extract_range_from_unary_expr_1): Likewise. + 2015-06-20 Marek Polacek * common.opt (fsanitize-undefined-trap-on-error): Add Driver. diff --git a/gcc/auto-inc-dec.c b/gcc/auto-inc-dec.c index 3241ed7c1e2..df52229322d 100644 --- a/gcc/auto-inc-dec.c +++ b/gcc/auto-inc-dec.c @@ -767,28 +767,6 @@ get_next_ref (int regno, basic_block bb, rtx_insn **next_array) } -/* Reverse the operands in a mem insn. */ - -static void -reverse_mem (void) -{ - rtx tmp = mem_insn.reg1; - mem_insn.reg1 = mem_insn.reg0; - mem_insn.reg0 = tmp; -} - - -/* Reverse the operands in a inc insn. */ - -static void -reverse_inc (void) -{ - rtx tmp = inc_insn.reg1; - inc_insn.reg1 = inc_insn.reg0; - inc_insn.reg0 = tmp; -} - - /* Return true if INSN is of a form "a = b op c" where a and b are regs. op is + if c is a reg and +|- if c is a const. Fill in INC_INSN with what is found. @@ -857,7 +835,7 @@ parse_add_or_inc (rtx_insn *insn, bool before_mem) { /* Reverse the two operands and turn *_ADD into *_INC since a = c + a. */ - reverse_inc (); + std::swap (inc_insn.reg0, inc_insn.reg1); inc_insn.form = before_mem ? FORM_PRE_INC : FORM_POST_INC; return true; } @@ -1017,7 +995,7 @@ find_inc (bool first_try) find this. Only try it once though. */ if (first_try && !mem_insn.reg1_is_const) { - reverse_mem (); + std::swap (mem_insn.reg0, mem_insn.reg1); return find_inc (false); } else @@ -1118,7 +1096,7 @@ find_inc (bool first_try) return false; if (!rtx_equal_p (mem_insn.reg0, inc_insn.reg0)) - reverse_inc (); + std::swap (inc_insn.reg0, inc_insn.reg1); } other_insn @@ -1168,7 +1146,7 @@ find_inc (bool first_try) /* See comment above on find_inc (false) call. */ if (first_try) { - reverse_mem (); + std::swap (mem_insn.reg0, mem_insn.reg1); return find_inc (false); } else @@ -1187,7 +1165,7 @@ find_inc (bool first_try) { /* We know that mem_insn.reg0 must equal inc_insn.reg1 or else we would not have found the inc insn. */ - reverse_mem (); + std::swap (mem_insn.reg0, mem_insn.reg1); if (!rtx_equal_p (mem_insn.reg0, inc_insn.reg0)) { /* See comment above on find_inc (false) call. */ @@ -1226,7 +1204,7 @@ find_inc (bool first_try) { if (first_try) { - reverse_mem (); + std::swap (mem_insn.reg0, mem_insn.reg1); return find_inc (false); } else diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 33cf7690bb6..39de58a9ea5 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,8 @@ +2015-06-22 Mikhail Maltsev + + * c-common.c (scalar_to_vector): Use std::swap instead of manually + swapping. + 2015-06-17 Andrew MacLeod * array-notation-common.c: Do not include input.h, line-map.h or is-a.h. diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index dc2bf00ebbc..c39a36deb30 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -12605,11 +12605,9 @@ scalar_to_vector (location_t loc, enum tree_code code, tree op0, tree op1, /* What about UNLT_EXPR? */ if (TREE_CODE (type0) == VECTOR_TYPE) { - tree tmp; ret = stv_secondarg; - /* Swap TYPE0 with TYPE1 and OP0 with OP1 */ - tmp = type0; type0 = type1; type1 = tmp; - tmp = op0; op0 = op1; op1 = tmp; + std::swap (type0, type1); + std::swap (op0, op1); } if (TREE_CODE (type0) == INTEGER_TYPE diff --git a/gcc/combine.c b/gcc/combine.c index 171e51dc4c7..f3802d7379a 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -5684,11 +5684,7 @@ combine_simplify_rtx (rtx x, machine_mode op0_mode, int in_dest, /* Make sure we pass the constant operand if any as the second one if this is a commutative operation. */ if (CONSTANT_P (inner_op0) && COMMUTATIVE_ARITH_P (x)) - { - rtx tem = inner_op0; - inner_op0 = inner_op1; - inner_op1 = tem; - } + std::swap (inner_op0, inner_op1); inner = simplify_binary_operation (code == MINUS ? PLUS : code == DIV ? MULT : code, diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 66564419fc0..7b3cd2ce720 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2015-06-22 Mikhail Maltsev + + * pt.c (maybe_adjust_types_for_deduction): Use std::swap instead of + manually swapping. + * semantics.c (finish_omp_atomic): Likewise. + * typeck.c (cp_build_array_ref): Likewise. + 2015-06-20 Mikhail Maltsev PR c++/65882 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index efb90e46f0f..8800af819ec 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -16545,15 +16545,11 @@ maybe_adjust_types_for_deduction (unification_kind_t strict, break; case DEDUCE_CONV: - { - /* Swap PARM and ARG throughout the remainder of this - function; the handling is precisely symmetric since PARM - will initialize ARG rather than vice versa. */ - tree* temp = parm; - parm = arg; - arg = temp; - break; - } + /* Swap PARM and ARG throughout the remainder of this + function; the handling is precisely symmetric since PARM + will initialize ARG rather than vice versa. */ + std::swap (parm, arg); + break; case DEDUCE_EXACT: /* Core issue #873: Do the DR606 thing (see below) for these cases, diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 9b5f050dfa4..aeb5f7ba298 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -6870,9 +6870,7 @@ finish_omp_atomic (enum tree_code code, enum tree_code opcode, tree lhs, bool swapped = false; if (rhs1 && cp_tree_equal (lhs, rhs)) { - tree tem = rhs; - rhs = rhs1; - rhs1 = tem; + std::swap (rhs, rhs1); swapped = !commutative_tree_code (opcode); } if (rhs1 && !cp_tree_equal (lhs, rhs1)) diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 22fbb6e2389..5b3fdfbf76b 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -3179,11 +3179,7 @@ cp_build_array_ref (location_t loc, tree array, tree idx, /* Put the integer in IND to simplify error checking. */ if (TREE_CODE (TREE_TYPE (ar)) == INTEGER_TYPE) - { - tree temp = ar; - ar = ind; - ind = temp; - } + std::swap (ar, ind); if (ar == error_mark_node || ind == error_mark_node) return error_mark_node; diff --git a/gcc/df-core.c b/gcc/df-core.c index 68d18497133..ea1f16842a2 100644 --- a/gcc/df-core.c +++ b/gcc/df-core.c @@ -1043,10 +1043,7 @@ df_worklist_dataflow_doublequeue (struct dataflow *dataflow, bitmap_iterator bi; unsigned int index; - /* Swap pending and worklist. */ - bitmap temp = worklist; - worklist = pending; - pending = temp; + std::swap (pending, worklist); EXECUTE_IF_SET_IN_BITMAP (worklist, 0, index, bi) { diff --git a/gcc/df-scan.c b/gcc/df-scan.c index 07e6ad5de51..ef9cdbbbe32 100644 --- a/gcc/df-scan.c +++ b/gcc/df-scan.c @@ -2133,14 +2133,6 @@ df_ref_ptr_compare (const void *r1, const void *r2) return df_ref_compare (*(const df_ref *) r1, *(const df_ref *) r2); } -static void -df_swap_refs (vec *ref_vec, int i, int j) -{ - df_ref tmp = (*ref_vec)[i]; - (*ref_vec)[i] = (*ref_vec)[j]; - (*ref_vec)[j] = tmp; -} - /* Sort and compress a set of refs. */ static void @@ -2160,7 +2152,7 @@ df_sort_and_compress_refs (vec *ref_vec) df_ref r0 = (*ref_vec)[0]; df_ref r1 = (*ref_vec)[1]; if (df_ref_compare (r0, r1) > 0) - df_swap_refs (ref_vec, 0, 1); + std::swap ((*ref_vec)[0], (*ref_vec)[1]); } else { diff --git a/gcc/dominance.c b/gcc/dominance.c index b39cd799225..a9e042ef4b5 100644 --- a/gcc/dominance.c +++ b/gcc/dominance.c @@ -484,11 +484,7 @@ link_roots (struct dom_info *di, TBB v, TBB w) di->path_min[s] = di->path_min[w]; di->set_size[v] += di->set_size[w]; if (di->set_size[v] < 2 * di->set_size[w]) - { - TBB tmp = s; - s = di->set_child[v]; - di->set_child[v] = tmp; - } + std::swap (di->set_child[v], s); /* Merge all subtrees. */ while (s) diff --git a/gcc/expr.c b/gcc/expr.c index 4eb1ab32c2f..78904c24bf2 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -8426,11 +8426,7 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode, Thus the following special case checks need only check the second operand. */ if (TREE_CODE (treeop0) == INTEGER_CST) - { - tree t1 = treeop0; - treeop0 = treeop1; - treeop1 = t1; - } + std::swap (treeop0, treeop1); /* First, check if we have a multiplication of one signed and one unsigned operand. */ @@ -8555,11 +8551,7 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode, def0 = get_def_for_expr (treeop1, NEGATE_EXPR); /* Swap operands if the 2nd operand is fed by a negate. */ if (def0) - { - tree tem = treeop0; - treeop0 = treeop1; - treeop1 = tem; - } + std::swap (treeop0, treeop1); } def2 = get_def_for_expr (treeop2, NEGATE_EXPR); @@ -8606,11 +8598,7 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode, Thus the following special case checks need only check the second operand. */ if (TREE_CODE (treeop0) == INTEGER_CST) - { - tree t1 = treeop0; - treeop0 = treeop1; - treeop1 = t1; - } + std::swap (treeop0, treeop1); /* Attempt to return something suitable for generating an indexed address, for machines that support that. */ @@ -10910,7 +10898,6 @@ do_store_flag (sepops ops, rtx target, machine_mode mode) { enum rtx_code code; tree arg0, arg1, type; - tree tem; machine_mode operand_mode; int unsignedp; rtx op0, op1; @@ -11033,7 +11020,7 @@ do_store_flag (sepops ops, rtx target, machine_mode mode) if (TREE_CODE (arg0) == REAL_CST || TREE_CODE (arg0) == INTEGER_CST || TREE_CODE (arg0) == FIXED_CST) { - tem = arg0; arg0 = arg1; arg1 = tem; + std::swap (arg0, arg1); code = swap_condition (code); } diff --git a/gcc/fold-const.c b/gcc/fold-const.c index e61d9463462..60aa2104960 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -15664,9 +15664,7 @@ fold_relational_const (enum tree_code code, tree type, tree op0, tree op1) if (code == LE_EXPR || code == GT_EXPR) { - tree tem = op0; - op0 = op1; - op1 = tem; + std::swap (op0, op1); code = swap_tree_comparison (code); } diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c index 2ec02c366eb..85ec738a9a4 100644 --- a/gcc/genattrtab.c +++ b/gcc/genattrtab.c @@ -2532,11 +2532,7 @@ simplify_test_exp (rtx exp, int insn_code, int insn_index) && compute_alternative_mask (right, IOR)) { if (GET_CODE (left) == IOR) - { - rtx tem = left; - left = right; - right = tem; - } + std::swap (left, right); newexp = attr_rtx (IOR, attr_rtx (AND, left, XEXP (right, 0)), diff --git a/gcc/gimple-match-head.c b/gcc/gimple-match-head.c index 86ba78bab80..7b1f1ace8f9 100644 --- a/gcc/gimple-match-head.c +++ b/gcc/gimple-match-head.c @@ -190,9 +190,7 @@ gimple_resimplify2 (gimple_seq *seq, || commutative_tree_code (*res_code)) && tree_swap_operands_p (res_ops[0], res_ops[1], false)) { - tree tem = res_ops[0]; - res_ops[0] = res_ops[1]; - res_ops[1] = tem; + std::swap (res_ops[0], res_ops[1]); if (TREE_CODE_CLASS ((enum tree_code) *res_code) == tcc_comparison) *res_code = swap_tree_comparison (*res_code); canonicalized = true; @@ -262,9 +260,7 @@ gimple_resimplify3 (gimple_seq *seq, && commutative_ternary_tree_code (*res_code) && tree_swap_operands_p (res_ops[0], res_ops[1], false)) { - tree tem = res_ops[0]; - res_ops[0] = res_ops[1]; - res_ops[1] = tem; + std::swap (res_ops[0], res_ops[1]); canonicalized = true; } @@ -427,9 +423,7 @@ gimple_simplify (enum tree_code code, tree type, || TREE_CODE_CLASS (code) == tcc_comparison) && tree_swap_operands_p (op0, op1, false)) { - tree tem = op0; - op0 = op1; - op1 = tem; + std::swap (op0, op1); if (TREE_CODE_CLASS (code) == tcc_comparison) code = swap_tree_comparison (code); } @@ -462,11 +456,7 @@ gimple_simplify (enum tree_code code, tree type, generation. */ if (commutative_ternary_tree_code (code) && tree_swap_operands_p (op0, op1, false)) - { - tree tem = op0; - op0 = op1; - op1 = tem; - } + std::swap (op0, op1); code_helper rcode; tree ops[3] = {}; diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index 648965c4208..7d4ad934003 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -2065,7 +2065,7 @@ noce_try_abs (struct noce_if_info *if_info) negate = 0; else if (GET_CODE (b) == NEG && rtx_equal_p (XEXP (b, 0), a)) { - c = a; a = b; b = c; + std::swap (a, b); negate = 1; } else if (GET_CODE (a) == NOT && rtx_equal_p (XEXP (a, 0), b)) @@ -2075,7 +2075,7 @@ noce_try_abs (struct noce_if_info *if_info) } else if (GET_CODE (b) == NOT && rtx_equal_p (XEXP (b, 0), a)) { - c = a; a = b; b = c; + std::swap (a, b); negate = 1; one_cmpl = true; } @@ -3390,11 +3390,7 @@ find_if_header (basic_block test_bb, int pass) if (then_edge->flags & EDGE_FALLTHRU) ; else if (else_edge->flags & EDGE_FALLTHRU) - { - edge e = else_edge; - else_edge = then_edge; - then_edge = e; - } + std::swap (then_edge, else_edge); else /* Otherwise this must be a multiway branch of some sort. */ return NULL; diff --git a/gcc/internal-fn.c b/gcc/internal-fn.c index 64ce8e34f4d..c398c125bcf 100644 --- a/gcc/internal-fn.c +++ b/gcc/internal-fn.c @@ -526,14 +526,10 @@ expand_addsub_overflow (location_t loc, tree_code code, tree lhs, /* PLUS_EXPR is commutative, if operand signedness differs, canonicalize to the first operand being signed and second unsigned to simplify following code. */ - rtx tem = op1; - op1 = op0; - op0 = tem; - tree t = arg1; - arg1 = arg0; - arg0 = t; - uns0_p = 0; - uns1_p = 1; + std::swap (op0, op1); + std::swap (arg0, arg1); + uns0_p = false; + uns1_p = true; } /* u1 +- u2 -> ur */ @@ -674,9 +670,7 @@ expand_addsub_overflow (location_t loc, tree_code code, tree lhs, int pos_neg0 = get_range_pos_neg (arg0); if (pos_neg0 != 3 && pos_neg == 3) { - rtx tem = op1; - op1 = op0; - op0 = tem; + std::swap (op0, op1); pos_neg = pos_neg0; } } @@ -781,22 +775,14 @@ expand_addsub_overflow (location_t loc, tree_code code, tree lhs, do_compare_rtx_and_jump will be just folded. Otherwise try to use range info if available. */ if (code == PLUS_EXPR && CONST_INT_P (op0)) - { - rtx tem = op0; - op0 = op1; - op1 = tem; - } + std::swap (op0, op1); else if (CONST_INT_P (op1)) ; else if (code == PLUS_EXPR && TREE_CODE (arg0) == SSA_NAME) { pos_neg = get_range_pos_neg (arg0); if (pos_neg != 3) - { - rtx tem = op0; - op0 = op1; - op1 = tem; - } + std::swap (op0, op1); } if (pos_neg == 3 && !CONST_INT_P (op1) && TREE_CODE (arg1) == SSA_NAME) pos_neg = get_range_pos_neg (arg1); @@ -1023,14 +1009,10 @@ expand_mul_overflow (location_t loc, tree lhs, tree arg0, tree arg1, /* Multiplication is commutative, if operand signedness differs, canonicalize to the first operand being signed and second unsigned to simplify following code. */ - rtx tem = op1; - op1 = op0; - op0 = tem; - tree t = arg1; - arg1 = arg0; - arg0 = t; - uns0_p = 0; - uns1_p = 1; + std::swap (op0, op1); + std::swap (arg0, arg1); + uns0_p = false; + uns1_p = true; } int pos_neg0 = get_range_pos_neg (arg0); diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index 6fba692577f..1bf4b1acb6b 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -1846,12 +1846,7 @@ add_type_duplicate (odr_type val, tree type) } if (prevail) - { - tree tmp = type; - - type = val->type; - val->type = tmp; - } + std::swap (val->type, type); val->types_set->add (type); diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c index 141b43672ce..c0d6a1d3f3f 100644 --- a/gcc/loop-iv.c +++ b/gcc/loop-iv.c @@ -664,7 +664,7 @@ get_biv_step_1 (df_ref def, rtx reg, rtx *outer_step) { rtx set, rhs, op0 = NULL_RTX, op1 = NULL_RTX; - rtx next, nextr, tmp; + rtx next, nextr; enum rtx_code code; rtx_insn *insn = DF_REF_INSN (def); df_ref next_def; @@ -694,9 +694,7 @@ get_biv_step_1 (df_ref def, rtx reg, op1 = XEXP (rhs, 1); if (code == PLUS && CONSTANT_P (op0)) - { - tmp = op0; op0 = op1; op1 = tmp; - } + std::swap (op0, op1); if (!simple_reg_p (op0) || !CONSTANT_P (op1)) @@ -2347,7 +2345,7 @@ iv_number_of_iterations (struct loop *loop, rtx_insn *insn, rtx condition, struct niter_desc *desc) { rtx op0, op1, delta, step, bound, may_xform, tmp, tmp0, tmp1; - struct rtx_iv iv0, iv1, tmp_iv; + struct rtx_iv iv0, iv1; rtx assumption, may_not_xform; enum rtx_code cond; machine_mode mode, comp_mode; @@ -2410,7 +2408,7 @@ iv_number_of_iterations (struct loop *loop, rtx_insn *insn, rtx condition, case GT: case GEU: case GTU: - tmp_iv = iv0; iv0 = iv1; iv1 = tmp_iv; + std::swap (iv0, iv1); cond = swap_condition (cond); break; case NE: diff --git a/gcc/lra-lives.c b/gcc/lra-lives.c index 8bf217f6865..16e1f386b3e 100644 --- a/gcc/lra-lives.c +++ b/gcc/lra-lives.c @@ -572,16 +572,10 @@ lra_setup_reload_pseudo_preferenced_hard_reg (int regno, && (lra_reg_info[regno].preferred_hard_regno_profit2 > lra_reg_info[regno].preferred_hard_regno_profit1)) { - int temp; - - temp = lra_reg_info[regno].preferred_hard_regno1; - lra_reg_info[regno].preferred_hard_regno1 - = lra_reg_info[regno].preferred_hard_regno2; - lra_reg_info[regno].preferred_hard_regno2 = temp; - temp = lra_reg_info[regno].preferred_hard_regno_profit1; - lra_reg_info[regno].preferred_hard_regno_profit1 - = lra_reg_info[regno].preferred_hard_regno_profit2; - lra_reg_info[regno].preferred_hard_regno_profit2 = temp; + std::swap (lra_reg_info[regno].preferred_hard_regno1, + lra_reg_info[regno].preferred_hard_regno2); + std::swap (lra_reg_info[regno].preferred_hard_regno_profit1, + lra_reg_info[regno].preferred_hard_regno_profit2); } if (lra_dump_file != NULL) { diff --git a/gcc/lra.c b/gcc/lra.c index 15e65f7b02f..5d1f429658f 100644 --- a/gcc/lra.c +++ b/gcc/lra.c @@ -1377,11 +1377,8 @@ lra_create_copy (int regno1, int regno2, int freq) regno1_dest_p = true; if (regno1 > regno2) { - int temp = regno2; - + std::swap (regno1, regno2); regno1_dest_p = false; - regno2 = regno1; - regno1 = temp; } cp = new lra_copy (); copy_vec.safe_push (cp); diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index 4671702d249..363da4c02d7 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -608,11 +608,8 @@ DFS::DFS (struct output_block *ob, tree expr, bool ref_p, bool this_ref_p, } } for (unsigned i = 0; i < scc_entry_len; ++i) - { - scc_entry tem = sccstack[first + i]; - sccstack[first + i] = sccstack[first + entry_start + i]; - sccstack[first + entry_start + i] = tem; - } + std::swap (sccstack[first + i], + sccstack[first + entry_start + i]); if (scc_entry_len == 1) ; /* We already sorted SCC deterministically in hash_scc. */ diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c index db76095fb65..60b39f81d18 100644 --- a/gcc/modulo-sched.c +++ b/gcc/modulo-sched.c @@ -2006,9 +2006,7 @@ get_sched_window (partial_schedule_ptr ps, ddg_node_ptr u_node, node close to its successors. */ if (pss_not_empty && count_succs >= count_preds) { - int tmp = end; - end = start; - start = tmp; + std::swap (start, end); step = -1; } diff --git a/gcc/omega.c b/gcc/omega.c index 4654df8cccd..829520a338a 100644 --- a/gcc/omega.c +++ b/gcc/omega.c @@ -547,11 +547,7 @@ omega_pretty_print_problem (FILE *file, omega_pb pb) else { if (pb->geqs[e].coef[v1] == 1) - { - v3 = v2; - v2 = v1; - v1 = v3; - } + std::swap (v1, v2); /* Relation is v1 <= v2 or v1 < v2. */ po[v1][v2] = ((pb->geqs[e].coef[0] == 0) ? le : lt); diff --git a/gcc/optabs.c b/gcc/optabs.c index 94739a945bc..491341b8887 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -4383,8 +4383,7 @@ prepare_float_lib_cmp (rtx x, rtx y, enum rtx_code comparison, if (code_to_optab (swapped) && (libfunc = optab_libfunc (code_to_optab (swapped), mode))) { - rtx tmp; - tmp = x; x = y; y = tmp; + std::swap (x, y); comparison = swapped; break; } @@ -6967,11 +6966,7 @@ expand_mult_highpart (machine_mode mode, rtx op0, rtx op1, tab1 = uns_p ? vec_widen_umult_lo_optab : vec_widen_smult_lo_optab; tab2 = uns_p ? vec_widen_umult_hi_optab : vec_widen_smult_hi_optab; if (BYTES_BIG_ENDIAN) - { - optab t = tab1; - tab1 = tab2; - tab2 = t; - } + std::swap (tab1, tab2); break; default: gcc_unreachable (); diff --git a/gcc/reload1.c b/gcc/reload1.c index a86084a8e29..57837a1fc90 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -5612,11 +5612,7 @@ reloads_unique_chain_p (int r1, int r2) /* The following loop assumes that r1 is the reload that feeds r2. */ if (r1 > r2) - { - int tmp = r2; - r2 = r1; - r1 = tmp; - } + std::swap (r1, r2); for (i = 0; i < n_reloads; i ++) /* Look for input reloads that aren't our two */ diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c index bb55e3ddfa8..f9b7655af12 100644 --- a/gcc/sel-sched-ir.c +++ b/gcc/sel-sched-ir.c @@ -4414,51 +4414,17 @@ free_data_sets (basic_block bb) free_av_set (bb); } -/* Exchange lv sets of TO and FROM. */ -static void -exchange_lv_sets (basic_block to, basic_block from) -{ - { - regset to_lv_set = BB_LV_SET (to); - - BB_LV_SET (to) = BB_LV_SET (from); - BB_LV_SET (from) = to_lv_set; - } - - { - bool to_lv_set_valid_p = BB_LV_SET_VALID_P (to); - - BB_LV_SET_VALID_P (to) = BB_LV_SET_VALID_P (from); - BB_LV_SET_VALID_P (from) = to_lv_set_valid_p; - } -} - - -/* Exchange av sets of TO and FROM. */ -static void -exchange_av_sets (basic_block to, basic_block from) -{ - { - av_set_t to_av_set = BB_AV_SET (to); - - BB_AV_SET (to) = BB_AV_SET (from); - BB_AV_SET (from) = to_av_set; - } - - { - int to_av_level = BB_AV_LEVEL (to); - - BB_AV_LEVEL (to) = BB_AV_LEVEL (from); - BB_AV_LEVEL (from) = to_av_level; - } -} - /* Exchange data sets of TO and FROM. */ void exchange_data_sets (basic_block to, basic_block from) { - exchange_lv_sets (to, from); - exchange_av_sets (to, from); + /* Exchange lv sets of TO and FROM. */ + std::swap (BB_LV_SET (from), BB_LV_SET (to)); + std::swap (BB_LV_SET_VALID_P (from), BB_LV_SET_VALID_P (to)); + + /* Exchange av sets of TO and FROM. */ + std::swap (BB_AV_SET (from), BB_AV_SET (to)); + std::swap (BB_AV_LEVEL (from), BB_AV_LEVEL (to)); } /* Copy data sets of FROM to TO. */ diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index a5731e83595..521fecf566e 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -944,10 +944,7 @@ simplify_unary_operation_1 (enum rtx_code code, machine_mode mode, rtx op) in2 = simplify_gen_unary (NOT, op_mode, in2, op_mode); if (GET_CODE (in2) == NOT && GET_CODE (in1) != NOT) - { - rtx tem = in2; - in2 = in1; in1 = tem; - } + std::swap (in1, in2); return gen_rtx_fmt_ee (GET_CODE (op) == IOR ? AND : IOR, mode, in1, in2); diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c index a5e17b85b08..e0ac936d72c 100644 --- a/gcc/tree-if-conv.c +++ b/gcc/tree-if-conv.c @@ -1510,11 +1510,7 @@ is_cond_scalar_reduction (gimple phi, gimple *reduc, tree arg_0, tree arg_1, /* Make R_OP1 to hold reduction variable. */ if (r_op2 == PHI_RESULT (header_phi) && reduction_op == PLUS_EXPR) - { - tree tmp = r_op1; - r_op1 = r_op2; - r_op2 = tmp; - } + std::swap (r_op1, r_op2); else if (r_op1 != PHI_RESULT (header_phi)) return false; @@ -1708,11 +1704,7 @@ predicate_scalar_phi (gphi *phi, gimple_stmt_iterator *gsi) second_edge = EDGE_PRED (bb, 1); cond = bb_predicate (first_edge->src); if (TREE_CODE (cond) == TRUTH_NOT_EXPR) - { - edge tmp_edge = first_edge; - first_edge = second_edge; - second_edge = tmp_edge; - } + std::swap (first_edge, second_edge); if (EDGE_COUNT (first_edge->src->succs) > 1) { cond = bb_predicate (second_edge->src); @@ -1795,11 +1787,7 @@ predicate_scalar_phi (gphi *phi, gimple_stmt_iterator *gsi) /* Put element with max number of occurences to the end of ARGS. */ if (max_ind != -1 && max_ind +1 != (int) args_len) - { - tree tmp = args[args_len - 1]; - args[args_len - 1] = args[max_ind]; - args[max_ind] = tmp; - } + std::swap (args[args_len - 1], args[max_ind]); /* Handle one special case when number of arguments with different values is equal 2 and one argument has the only occurrence. Such PHI can be @@ -2174,11 +2162,7 @@ predicate_mem_writes (loop_p loop) lhs = ifc_temp_var (type, unshare_expr (lhs), &gsi); rhs = ifc_temp_var (type, unshare_expr (rhs), &gsi); if (swap) - { - tree tem = lhs; - lhs = rhs; - rhs = tem; - } + std::swap (lhs, rhs); cond = force_gimple_operand_gsi_1 (&gsi, unshare_expr (cond), is_gimple_condexpr, NULL_TREE, true, GSI_SAME_STMT); diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c index 96fbc3620f5..19523b941d2 100644 --- a/gcc/tree-loop-distribution.c +++ b/gcc/tree-loop-distribution.c @@ -1360,9 +1360,7 @@ pg_add_dependence_edges (struct graph *rdg, vec loops, int dir, if (rdg_vertex_for_stmt (rdg, DR_STMT (dr1)) > rdg_vertex_for_stmt (rdg, DR_STMT (dr2))) { - data_reference_p tem = dr1; - dr1 = dr2; - dr2 = tem; + std::swap (dr1, dr2); this_dir = -this_dir; } ddr = initialize_data_dependence_relation (dr1, dr2, loops); @@ -1373,9 +1371,7 @@ pg_add_dependence_edges (struct graph *rdg, vec loops, int dir, { if (DDR_REVERSED_P (ddr)) { - data_reference_p tem = dr1; - dr1 = dr2; - dr2 = tem; + std::swap (dr1, dr2); this_dir = -this_dir; } /* Known dependences can still be unordered througout the diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c index 341bcc77a8e..eadad7e0ad2 100644 --- a/gcc/tree-predcom.c +++ b/gcc/tree-predcom.c @@ -2301,11 +2301,7 @@ combine_chains (chain_p ch1, chain_p ch2) } if (swap) - { - chain_p tmp = ch1; - ch1 = ch2; - ch2 = tmp; - } + std::swap (ch1, ch2); new_chain = XCNEW (struct chain); new_chain->type = CT_COMBINATION; diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index d9aae421fbc..a1f0beeae63 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -953,11 +953,7 @@ nonoverlapping_component_refs_p (const_tree x, const_tree y) if (fieldsx.length () == 2) { if (ncr_compar (&fieldsx[0], &fieldsx[1]) == 1) - { - const_tree tem = fieldsx[0]; - fieldsx[0] = fieldsx[1]; - fieldsx[1] = tem; - } + std::swap (fieldsx[0], fieldsx[1]); } else fieldsx.qsort (ncr_compar); @@ -965,11 +961,7 @@ nonoverlapping_component_refs_p (const_tree x, const_tree y) if (fieldsy.length () == 2) { if (ncr_compar (&fieldsy[0], &fieldsy[1]) == 1) - { - const_tree tem = fieldsy[0]; - fieldsy[0] = fieldsy[1]; - fieldsy[1] = tem; - } + std::swap (fieldsy[0], fieldsy[1]); } else fieldsy.qsort (ncr_compar); @@ -1426,13 +1418,10 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) /* Canonicalize the pointer-vs-decl case. */ if (ind1_p && var2_p) { - HOST_WIDE_INT tmp1; - tree tmp2; - ao_ref *tmp3; - tmp1 = offset1; offset1 = offset2; offset2 = tmp1; - tmp1 = max_size1; max_size1 = max_size2; max_size2 = tmp1; - tmp2 = base1; base1 = base2; base2 = tmp2; - tmp3 = ref1; ref1 = ref2; ref2 = tmp3; + std::swap (offset1, offset2); + std::swap (max_size1, max_size2); + std::swap (base1, base2); + std::swap (ref1, ref2); var1_p = true; ind1_p = false; var2_p = false; diff --git a/gcc/tree-ssa-ifcombine.c b/gcc/tree-ssa-ifcombine.c index 650624e49f3..f55a4528d49 100644 --- a/gcc/tree-ssa-ifcombine.c +++ b/gcc/tree-ssa-ifcombine.c @@ -98,11 +98,7 @@ recognize_if_then_else (basic_block cond_bb, t = EDGE_SUCC (cond_bb, 0); e = EDGE_SUCC (cond_bb, 1); if (!(t->flags & EDGE_TRUE_VALUE)) - { - edge tmp = t; - t = e; - e = tmp; - } + std::swap (t, e); if (!(t->flags & EDGE_TRUE_VALUE) || !(e->flags & EDGE_FALSE_VALUE)) return false; diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index cb5f054720d..cab5acfc8d5 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -1485,8 +1485,8 @@ extract_cond_operands (struct ivopts_data *data, gimple stmt, /* The objects returned when COND has constant operands. */ static struct iv const_iv; static tree zero; - tree *op0 = &zero, *op1 = &zero, *tmp_op; - struct iv *iv0 = &const_iv, *iv1 = &const_iv, *tmp_iv; + tree *op0 = &zero, *op1 = &zero; + struct iv *iv0 = &const_iv, *iv1 = &const_iv; bool ret = false; if (gimple_code (stmt) == GIMPLE_COND) @@ -1517,8 +1517,8 @@ extract_cond_operands (struct ivopts_data *data, gimple stmt, if (integer_zerop (iv0->step)) { /* Control variable may be on the other side. */ - tmp_op = op0; op0 = op1; op1 = tmp_op; - tmp_iv = iv0; iv0 = iv1; iv1 = tmp_iv; + std::swap (op0, op1); + std::swap (iv0, iv1); } ret = !integer_zerop (iv0->step) && integer_zerop (iv1->step); diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index 64c9a73e03f..213d72e3dc4 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -73,8 +73,6 @@ along with GCC; see the file COPYING3. If not see #include "wide-int-print.h" -#define SWAP(X, Y) do { affine_iv *tmp = (X); (X) = (Y); (Y) = tmp; } while (0) - /* The maximum number of dominator BBs we search for conditions of loop header copies we use for simplifying a conditional expression. */ @@ -301,7 +299,7 @@ refine_bounds_using_guard (tree type, tree varx, mpz_t offx, tree c0, enum tree_code cmp, tree c1, bounds *bnds) { - tree varc0, varc1, tmp, ctype; + tree varc0, varc1, ctype; mpz_t offc0, offc1, loffx, loffy, bnd; bool lbound = false; bool no_wrap = nowrap_type_p (type); @@ -371,7 +369,7 @@ refine_bounds_using_guard (tree type, tree varx, mpz_t offx, if (operand_equal_p (varx, varc1, 0)) { - tmp = varc0; varc0 = varc1; varc1 = tmp; + std::swap (varc0, varc1); mpz_swap (offc0, offc1); cmp = swap_tree_comparison (cmp); } @@ -385,7 +383,7 @@ refine_bounds_using_guard (tree type, tree varx, mpz_t offx, if (cmp == GT_EXPR || cmp == GE_EXPR) { - tmp = varx; varx = vary; vary = tmp; + std::swap (varx, vary); mpz_swap (offc0, offc1); mpz_swap (loffx, loffy); cmp = swap_tree_comparison (cmp); @@ -1365,7 +1363,7 @@ number_of_iterations_cond (struct loop *loop, if (code == GE_EXPR || code == GT_EXPR || (code == NE_EXPR && integer_zerop (iv0->step))) { - SWAP (iv0, iv1); + std::swap (iv0, iv1); code = swap_tree_comparison (code); } diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index 098a02868e2..d2a5cee2329 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -237,12 +237,8 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool do_hoist_loads) ; else if (EDGE_SUCC (bb2, 0)->dest == bb1) { - basic_block bb_tmp = bb1; - edge e_tmp = e1; - bb1 = bb2; - bb2 = bb_tmp; - e1 = e2; - e2 = e_tmp; + std::swap (bb1, bb2); + std::swap (e1, e2); } else if (do_store_elim && EDGE_SUCC (bb1, 0)->dest == EDGE_SUCC (bb2, 0)->dest) diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 3db42b03bbb..ccfa6b603ec 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -2389,11 +2389,7 @@ vn_nary_op_compute_hash (const vn_nary_op_t vno1) if (vno1->length == 2 && commutative_tree_code (vno1->opcode) && tree_swap_operands_p (vno1->op[0], vno1->op[1], false)) - { - tree temp = vno1->op[0]; - vno1->op[0] = vno1->op[1]; - vno1->op[1] = temp; - } + std::swap (vno1->op[0], vno1->op[1]); hstate.add_int (vno1->opcode); for (i = 0; i < vno1->length; ++i) diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 47d8a42474e..91ddc0fc444 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -1124,9 +1124,8 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, for (j = 0; j < group_size; ++j) if (!matches[j]) { - gimple tem = oprnds_info[0]->def_stmts[j]; - oprnds_info[0]->def_stmts[j] = oprnds_info[1]->def_stmts[j]; - oprnds_info[1]->def_stmts[j] = tem; + std::swap (oprnds_info[0]->def_stmts[j], + oprnds_info[1]->def_stmts[j]); dump_printf (MSG_NOTE, "%d ", j); } dump_printf (MSG_NOTE, "\n"); diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 9760d9a471f..0b9c8d6e1f9 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -8259,11 +8259,7 @@ supportable_widening_operation (enum tree_code code, gimple stmt, } if (BYTES_BIG_ENDIAN && c1 != VEC_WIDEN_MULT_EVEN_EXPR) - { - enum tree_code ctmp = c1; - c1 = c2; - c2 = ctmp; - } + std::swap (c1, c2); if (code == FIX_TRUNC_EXPR) { diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index a7e66f14f2b..fdaebe4c2fc 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -2914,33 +2914,17 @@ extract_range_from_binary_expr_1 (value_range_t *vr, prod3. */ /* min0min1 > max0max1 */ if (wi::gts_p (prod0, prod3)) - { - vrp_int tmp = prod3; - prod3 = prod0; - prod0 = tmp; - } + std::swap (prod0, prod3); /* min0max1 > max0min1 */ if (wi::gts_p (prod1, prod2)) - { - vrp_int tmp = prod2; - prod2 = prod1; - prod1 = tmp; - } + std::swap (prod1, prod2); if (wi::gts_p (prod0, prod1)) - { - vrp_int tmp = prod1; - prod1 = prod0; - prod0 = tmp; - } + std::swap (prod0, prod1); if (wi::gts_p (prod2, prod3)) - { - vrp_int tmp = prod3; - prod3 = prod2; - prod2 = tmp; - } + std::swap (prod2, prod3); /* diff = max - min. */ prod2 = prod3 - prod0; @@ -3723,11 +3707,7 @@ extract_range_from_unary_expr_1 (value_range_t *vr, { /* If the range was reversed, swap MIN and MAX. */ if (cmp == 1) - { - tree t = min; - min = max; - max = t; - } + std::swap (min, max); } cmp = compare_values (min, max); -- cgit v1.2.1