Hi all, Reference and move semantics are a part of C++ that experienced engineers still get subtly wrong, so I audited the tree with clang-tidy's performance-* checks, which trace whether a by-value parameter is ever mutated or a std::move target is actually reachable -- the kind of exhaustive per-parameter check regular compiler warnings and human review aren't built to do. Only patch 1 has a measured performance number; patches 2-5 are correctness/consistency fixes in the same spirit with no individual perf claim. No functional change is intended anywhere in the series.
Patch 1 removes a needless deep-copy of program_state (which owns a whole region_model) when -fanalyzer creates an exploded_node, by giving program_state a move-assignment operator and threading the move through point_and_state and exploded_node. Testing: - x86_64-pc-linux-gnu, --enable-languages=c,c++,lto, --disable-bootstrap. - check-gcc analyzer.exp/tree-ssa.exp/ipa.exp on current trunk (492fbdbf99d): 16820+10537 pass. Same 2 pre-existing failures as unpatched trunk, unrelated to this series: * omp-parallel-for-1.c: -Wanalyzer-symbol-too-complex depth boundary. * ssa-sink-18.c: known r17-3756 regression (unrelated ivopts change). - Timing (patch 1 only): 8 interleaved `cc1 -fanalyzer` runs on libiberty/cp-demangle.c, binary swapped each run: 63.98s -> 60.10s median (6.06% faster), no overlap across all 8 pairs. Full test logs and the benchmark script are available on request. I don't have push access; posting for review. Happy to split patch 1 out on its own if that's preferred, or to fold 2-5 together -- they're independent of each other and of patch 1. The five patches are attached as plain-text files. linden (5): analyzer: avoid deep-copying program_state when creating an exploded_node analyzer, diagnostics: add missing std::move for by-value sinks diagnostics: take HTML tag names as const char * in source-printing gcc, analyzer: drop std::move calls that have no effect range-op, tree-ssa-ccp, fold-const, ipa-cp: bind wide_int / widest_int by reference gcc/analyzer/access-diagram.cc | 2 +- gcc/analyzer/engine.cc | 17 ++++++++++++----- gcc/analyzer/exploded-graph.h | 16 ++++++++++++++++ gcc/analyzer/infinite-loop.cc | 2 +- gcc/analyzer/program-state.cc | 27 +++++++++++++++++++++++++++ gcc/analyzer/program-state.h | 1 + gcc/diagnostics/html-sink.cc | 4 ++-- gcc/diagnostics/source-printing.cc | 27 ++++++++++++--------------- gcc/fold-const.cc | 9 +++++---- gcc/fold-const.h | 8 ++++---- gcc/gcov.cc | 2 +- gcc/ipa-cp.cc | 9 ++++++--- gcc/ipa-cp.h | 6 +++--- gcc/range-op.cc | 10 +++++----- gcc/text-art/canvas.cc | 2 +- gcc/tree-ssa-ccp.cc | 5 +++-- gcc/xml.cc | 2 +- 17 files changed, 101 insertions(+), 48 deletions(-) Regards, Linden
From d4cdac17bc2cd255a2774edb99fbebaeaae7e61d Mon Sep 17 00:00:00 2001 From: linden <[email protected]> Date: Sun, 6 Sep 2026 15:58:46 +1200 Subject: [PATCH 2/5] analyzer, diagnostics: add missing std::move for by-value sinks Three spots take an argument clearly meant to be sunk (by-value parameters, an rvalue-reference ctor param) but copy it instead of moving. Move in all three: infinite_loop's ctor, and add_labelled_value's 'id'/'label' parameters, matching the sibling 'value' parameter which was already moved. gcc/analyzer/ChangeLog: * infinite-loop.cc (infinite_loop::infinite_loop): std::move eedges into m_eedge_vec. gcc/ChangeLog: * diagnostics/html-sink.cc (add_labelled_value): std::move 'id' and 'label' into the xml::printer calls. Signed-off-by: linden <[email protected]> --- gcc/analyzer/infinite-loop.cc | 2 +- gcc/diagnostics/html-sink.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/analyzer/infinite-loop.cc b/gcc/analyzer/infinite-loop.cc index e1175cea624..234f2281967 100644 --- a/gcc/analyzer/infinite-loop.cc +++ b/gcc/analyzer/infinite-loop.cc @@ -53,7 +53,7 @@ struct infinite_loop logger *logger) : m_enode (enode), m_loc (loc), - m_eedge_vec (eedges) + m_eedge_vec (std::move (eedges)) { LOG_SCOPE (logger); if (logger) diff --git a/gcc/diagnostics/html-sink.cc b/gcc/diagnostics/html-sink.cc index 185fc495f50..6a743a91ea6 100644 --- a/gcc/diagnostics/html-sink.cc +++ b/gcc/diagnostics/html-sink.cc @@ -862,9 +862,9 @@ add_labelled_value (xml::printer &xp, bool quote_value) { xp.push_tag ("div", true); - xp.set_attr ("id", id); + xp.set_attr ("id", std::move (id)); xp.push_tag ("span"); - xp.add_text (label); + xp.add_text (std::move (label)); xp.add_text (" "); xp.pop_tag ("span"); xp.push_tag ("span"); -- 2.53.0
From 22f7a0ac17e259ec93fa054a56605a06912bd7a3 Mon Sep 17 00:00:00 2001 From: linden <[email protected]> Date: Sun, 6 Sep 2026 15:58:20 +1200 Subject: [PATCH 1/5] analyzer: avoid deep-copying program_state when creating an exploded_node get_or_create_node deep-copied program_state twice when creating a node, even though the source was discarded right after; program_state owns its region_model via pointer, so each copy cloned it. Add move support to program_state, point_and_state and exploded_node, cutting a new node's cost from three deep-copies to one. The pruned_state copy used as the hash-map key stays, since the merge loop needs it stable while mutating the key. gcc/analyzer/ChangeLog: * program-state.h (program_state::operator=): Declare move-assignment overload. * program-state.cc (program_state::operator=): Implement it: steal the region_model and sm_state_map pointers, leaving the source empty. * exploded-graph.h (point_and_state::point_and_state): Add a move ctor; explicitly default the copy ctor. (point_and_state::set_state): Add a program_state&& overload. (exploded_node::exploded_node): Declare a (point_and_state&&, int) overload. * engine.cc (exploded_node::exploded_node): Implement the (point_and_state&&, int) overload; check m_ps rather than the argument in the existing overload's assertion. (exploded_graph::get_or_create_node): Move the merged state into point_and_state::set_state; move the point_and_state into the new exploded_node; log node->get_state () instead of the moved-from ps. Signed-off-by: linden <[email protected]> --- gcc/analyzer/engine.cc | 15 +++++++++++---- gcc/analyzer/exploded-graph.h | 16 ++++++++++++++++ gcc/analyzer/program-state.cc | 27 +++++++++++++++++++++++++++ gcc/analyzer/program-state.h | 1 + 4 files changed, 55 insertions(+), 4 deletions(-) diff --git a/gcc/analyzer/engine.cc b/gcc/analyzer/engine.cc index 59cdcc51e6c..830164dac77 100644 --- a/gcc/analyzer/engine.cc +++ b/gcc/analyzer/engine.cc @@ -1030,7 +1030,14 @@ exploded_node::exploded_node (const point_and_state &ps, int index) : m_ps (ps), m_status (status::worklist), m_index (index) { - gcc_checking_assert (ps.get_state ().m_region_model->canonicalized_p ()); + gcc_checking_assert (m_ps.get_state ().m_region_model->canonicalized_p ()); +} + +exploded_node::exploded_node (point_and_state &&ps, + int index) +: m_ps (std::move (ps)), m_status (status::worklist), m_index (index) +{ + gcc_checking_assert (m_ps.get_state ().m_region_model->canonicalized_p ()); } /* For use by dump_dot, get a value for the .dot "fillcolor" attribute. @@ -2571,7 +2578,7 @@ exploded_graph::get_or_create_node (const program_point &point, Whether we get one or not, merged_state's value_ids have no relationship to those of the input state, and thus to those of CHANGE, so we must purge any svalue_ids from *CHANGE. */ - ps.set_state (merged_state); + ps.set_state (std::move (merged_state)); if (exploded_node **slot = m_point_and_state_to_node.get (&ps)) { @@ -2612,7 +2619,7 @@ exploded_graph::get_or_create_node (const program_point &point, ps.validate (m_ext_state); /* An exploded_node for "ps" doesn't already exist; create one. */ - exploded_node *node = new exploded_node (ps, m_nodes.length ()); + exploded_node *node = new exploded_node (std::move (ps), m_nodes.length ()); add_node (node); m_point_and_state_to_node.put (node->get_ps_key (), node); @@ -2634,7 +2641,7 @@ exploded_graph::get_or_create_node (const program_point &point, logger->end_log_line (); logger->start_log_line (); pp_string (pp, "state: "); - ps.get_state ().dump_to_pp (m_ext_state, true, false, pp); + node->get_state ().dump_to_pp (m_ext_state, true, false, pp); logger->end_log_line (); } diff --git a/gcc/analyzer/exploded-graph.h b/gcc/analyzer/exploded-graph.h index 7a0060521db..c33bd476c9d 100644 --- a/gcc/analyzer/exploded-graph.h +++ b/gcc/analyzer/exploded-graph.h @@ -150,6 +150,15 @@ public: gcc_assert (state.m_valid); } + point_and_state (const point_and_state &other) = default; + + point_and_state (point_and_state &&other) + : m_point (other.m_point), + m_state (std::move (other.m_state)), + m_hash (other.m_hash) + { + } + hashval_t hash () const { return m_hash; @@ -168,6 +177,12 @@ public: m_hash = m_point.hash () ^ m_state.hash (); } + void set_state (program_state &&state) + { + m_state = std::move (state); + m_hash = m_point.hash () ^ m_state.hash (); + } + void validate (const extrinsic_state &ext_state) const; private: @@ -231,6 +246,7 @@ class exploded_node : public dnode<eg_traits> static const char * status_to_str (enum status s); exploded_node (const point_and_state &ps, int index); + exploded_node (point_and_state &&ps, int index); hashval_t hash () const { return m_ps.hash (); } diff --git a/gcc/analyzer/program-state.cc b/gcc/analyzer/program-state.cc index 5ebaafb2661..1c1c58784f4 100644 --- a/gcc/analyzer/program-state.cc +++ b/gcc/analyzer/program-state.cc @@ -1021,6 +1021,33 @@ program_state::program_state (program_state &&other) m_valid = other.m_valid; } +/* Move assignment for program_state. */ + +program_state& +program_state::operator= (program_state &&other) +{ + if (this == &other) + return *this; + + delete m_region_model; + m_region_model = other.m_region_model; + other.m_region_model = nullptr; + + int i; + sm_state_map *smap; + FOR_EACH_VEC_ELT (m_checker_states, i, smap) + delete smap; + m_checker_states.truncate (0); + gcc_assert (m_checker_states.space (other.m_checker_states.length ())); + FOR_EACH_VEC_ELT (other.m_checker_states, i, smap) + m_checker_states.quick_push (smap); + other.m_checker_states.truncate (0); + + m_valid = other.m_valid; + + return *this; +} + /* program_state's dtor. */ program_state::~program_state () diff --git a/gcc/analyzer/program-state.h b/gcc/analyzer/program-state.h index 98207500316..e098d84a455 100644 --- a/gcc/analyzer/program-state.h +++ b/gcc/analyzer/program-state.h @@ -227,6 +227,7 @@ public: program_state (const program_state &other); program_state& operator= (const program_state &other); program_state (program_state &&other); + program_state& operator= (program_state &&other); ~program_state (); hashval_t hash () const; -- 2.53.0
From 61e7fda9af3ba1a8ae1e0fb322c732128cbedb18 Mon Sep 17 00:00:00 2001 From: linden <[email protected]> Date: Sun, 6 Sep 2026 16:00:32 +1200 Subject: [PATCH 3/5] diagnostics: take HTML tag names as const char * in source-printing to_text/to_html's tag-name helpers took std::string by value though every call site passes a literal; to_text's bodies are no-ops, so this built a string only to discard it. Take these as const char* instead: to_text's path becomes free, to_html's cost is unchanged, and the now-meaningless std::move wrappers on that side are dropped. gcc/ChangeLog: * diagnostics/source-printing.cc (to_text::push_html_tag) (to_text::push_html_tag_with_class, to_text::add_html_tag_with_class) (to_html::push_html_tag, to_html::push_html_tag_with_class) (to_html::add_html_tag_with_class): Take tag/class names as const char * rather than std::string by value. Signed-off-by: linden <[email protected]> --- gcc/diagnostics/source-printing.cc | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/gcc/diagnostics/source-printing.cc b/gcc/diagnostics/source-printing.cc index db9b3c1f241..48af87ab242 100644 --- a/gcc/diagnostics/source-printing.cc +++ b/gcc/diagnostics/source-printing.cc @@ -445,11 +445,11 @@ struct to_text pp_emit_prefix (&m_pp); } - void push_html_tag (std::string, bool) + void push_html_tag (const char *, bool) { // no-op for text } - void push_html_tag_with_class (std::string, std::string, bool) + void push_html_tag_with_class (const char *, const char *, bool) { // no-op for text } @@ -458,7 +458,7 @@ struct to_text // no-op for text } - void add_html_tag_with_class (std::string, std::string, bool) + void add_html_tag_with_class (const char *, const char *, bool) { // no-op for text } @@ -571,19 +571,17 @@ struct to_html // no-op for HTML } - void push_html_tag (std::string name, + void push_html_tag (const char *name, bool preserve_whitespace) { - m_xp.push_tag (std::move (name), preserve_whitespace); + m_xp.push_tag (name, preserve_whitespace); } - void push_html_tag_with_class (std::string name, - std::string class_, + void push_html_tag_with_class (const char *name, + const char *class_, bool preserve_whitespace) { - m_xp.push_tag_with_class (std::move (name), - std::move (class_), - preserve_whitespace); + m_xp.push_tag_with_class (name, class_, preserve_whitespace); } void pop_html_tag (const char *expected_name) @@ -591,13 +589,12 @@ struct to_html m_xp.pop_tag (expected_name); } - void add_html_tag_with_class (std::string name, - std::string class_, + void add_html_tag_with_class (const char *name, + const char *class_, bool preserve_whitespace) { - auto element = std::make_unique<xml::element> (std::move (name), - preserve_whitespace); - element->set_attr ("class", std::move (class_)); + auto element = std::make_unique<xml::element> (name, preserve_whitespace); + element->set_attr ("class", class_); m_xp.append (std::move (element)); } -- 2.53.0
From 5a0ce486105a7f42556e8e64fcb287253ddb58f9 Mon Sep 17 00:00:00 2001 From: linden <[email protected]> Date: Sun, 6 Sep 2026 16:14:31 +1200 Subject: [PATCH 4/5] gcc, analyzer: drop std::move calls that have no effect Five call sites wrap an argument in std::move where no move can actually happen: the callee only takes a const reference, there is no std::string::operator+=(std::string&&), or the source is a std::map key (always const). Remove the std::move in each; behaviour is unchanged. gcc/ChangeLog: * xml.cc (node_with_children::add_text): Remove no-op std::move. * gcov.cc (path_info::suppress_blocks): Likewise. * text-art/canvas.cc (canvas::paint): Likewise. gcc/analyzer/ChangeLog: * access-diagram.cc (access_diagram_impl::make_warning_string): Remove no-op std::move. * engine.cc (exploded_graph::unwind_from_exception): Likewise. Signed-off-by: linden <[email protected]> --- gcc/analyzer/access-diagram.cc | 2 +- gcc/analyzer/engine.cc | 2 +- gcc/gcov.cc | 2 +- gcc/text-art/canvas.cc | 2 +- gcc/xml.cc | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gcc/analyzer/access-diagram.cc b/gcc/analyzer/access-diagram.cc index 9caafcdb55d..861823f6aea 100644 --- a/gcc/analyzer/access-diagram.cc +++ b/gcc/analyzer/access-diagram.cc @@ -2347,7 +2347,7 @@ private: overlapping the next char. Hence we add two spaces here: a space to be covered by this overlap, plus another space of padding. */ result.append (styled_string (m_sm, " ")); - result.append (std::move (text)); + result.append (text); return result; } diff --git a/gcc/analyzer/engine.cc b/gcc/analyzer/engine.cc index 830164dac77..c8a7dcef730 100644 --- a/gcc/analyzer/engine.cc +++ b/gcc/analyzer/engine.cc @@ -1498,7 +1498,7 @@ exploded_graph::unwind_from_exception (exploded_node &thrown_enode, exploded_node *after_unwind_enode = get_or_create_node (unwound_point, - std::move (unwound_state), + unwound_state, iter_enode, /* Don't add this enode to the worklist; we will process it diff --git a/gcc/gcov.cc b/gcc/gcov.cc index 06047a60460..42b483aca87 100644 --- a/gcc/gcov.cc +++ b/gcc/gcov.cc @@ -1121,7 +1121,7 @@ path_info::suppress_blocks (const vector<bool>& suppressed) /* Store the new paths. The map iteration outputs the paths lexicographically ordered. */ for (auto& p : nextpaths) - residual_paths.push_back (std::move (p.first)); + residual_paths.push_back (p.first); } /* Find the arc that connects BLOCK to the block with id DEST, or nullptr if it diff --git a/gcc/text-art/canvas.cc b/gcc/text-art/canvas.cc index 1c14c32103a..9c333e492c0 100644 --- a/gcc/text-art/canvas.cc +++ b/gcc/text-art/canvas.cc @@ -39,7 +39,7 @@ canvas::canvas (size_t size, const style_manager &style_mgr) void canvas::paint (coord_t coord, styled_unichar ch) { - m_cells.set (coord, std::move (ch)); + m_cells.set (coord, ch); } void diff --git a/gcc/xml.cc b/gcc/xml.cc index ad6b8460b6f..4659b69afe4 100644 --- a/gcc/xml.cc +++ b/gcc/xml.cc @@ -116,7 +116,7 @@ node_with_children::add_text (std::string str) if (!m_children.empty ()) if (text *t = m_children.back ()->dyn_cast_text ()) { - t->m_str += std::move (str); + t->m_str += str; return; } add_child (std::make_unique <text> (std::move (str))); -- 2.53.0
From a42662230a70ddad31df270264c3872029c4b40c Mon Sep 17 00:00:00 2001 From: linden <[email protected]> Date: Sun, 6 Sep 2026 16:53:14 +1200 Subject: [PATCH 5/5] range-op, tree-ssa-ccp, fold-const, ipa-cp: bind wide_int / widest_int by reference wide_int and widest_int are 40-130 byte inline-buffer types; several locals and by-value parameters across Ranger, CCP, fold-const and ipa-cp copy one where only reading is needed. Bind these by const reference instead; no functional change. bit_value_binop's rotate arm keeps its copy since it reassigns 'shift'. gcc/ChangeLog: * range-op.cc (operator_div::wi_fold): Bind dividend_min/max and divisor_min/max as const wide_int & rather than copying. (operator_bitwise_xor::wi_fold): Likewise for new_lb. * tree-ssa-ccp.cc (valid_lattice_transition): Take old_val and new_val as const ccp_prop_value_t &. (bit_value_binop): Bind 'shift' as const widest_int & in the shift arm. * fold-const.h (minmax_from_comparison, fold_cmp_float_cst_p): Take widest_int / wide_int parameters by const reference. * fold-const.cc (minmax_from_comparison, fold_cmp_float_cst_p): Likewise. * ipa-cp.h (ipcp_bits_lattice::set_to_constant) (ipcp_bits_lattice::meet_with, ipcp_bits_lattice::meet_with_1): Take widest_int parameters by const reference. * ipa-cp.cc (ipcp_bits_lattice::set_to_constant) (ipcp_bits_lattice::meet_with, ipcp_bits_lattice::meet_with_1): Likewise. Signed-off-by: linden <[email protected]> --- gcc/fold-const.cc | 9 +++++---- gcc/fold-const.h | 8 ++++---- gcc/ipa-cp.cc | 9 ++++++--- gcc/ipa-cp.h | 6 +++--- gcc/range-op.cc | 10 +++++----- gcc/tree-ssa-ccp.cc | 5 +++-- 6 files changed, 26 insertions(+), 21 deletions(-) diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc index 4c4b535d440..8d6ab29b5e4 100644 --- a/gcc/fold-const.cc +++ b/gcc/fold-const.cc @@ -198,8 +198,8 @@ static tree fold_negate_expr (location_t, tree); The form is "(exp0 CMP cst1) ? exp0 : cst2". */ tree_code minmax_from_comparison (tree_code cmp, tree exp0, - const widest_int cst1, - const widest_int cst2) + const widest_int &cst1, + const widest_int &cst2) { if (cst1 == cst2) { @@ -7113,9 +7113,10 @@ fold_real_zero_addition_p (const_tree type, const_tree arg, due to truncation/rounding. */ bool -fold_cmp_float_cst_p (wide_int lo, wide_int hi, enum tree_code cmp, +fold_cmp_float_cst_p (const wide_int &lo, const wide_int &hi, + enum tree_code cmp, const REAL_VALUE_TYPE *r, format_helper fmt, - wide_int i, signop isign) + const wide_int &i, signop isign) { REAL_VALUE_TYPE raw; REAL_VALUE_TYPE rnd; diff --git a/gcc/fold-const.h b/gcc/fold-const.h index ab03bf0aa35..437d8ece021 100644 --- a/gcc/fold-const.h +++ b/gcc/fold-const.h @@ -173,11 +173,11 @@ extern bool integer_valued_real_p (tree, int = 0); extern bool fold_real_zero_addition_p (const_tree, const_tree, const_tree, int); -extern bool fold_cmp_float_cst_p (wide_int lo, wide_int hi, +extern bool fold_cmp_float_cst_p (const wide_int &lo, const wide_int &hi, enum tree_code cmp, const REAL_VALUE_TYPE *r, format_helper fmt, - wide_int i, signop isign); + const wide_int &i, signop isign); extern tree combine_comparisons (location_t, enum tree_code, enum tree_code, enum tree_code, tree, tree, tree); @@ -253,8 +253,8 @@ extern tree fold_build_pointer_plus_hwi_loc (location_t loc, tree ptr, HOST_WIDE fold_build_pointer_plus_hwi_loc (UNKNOWN_LOCATION, p, o) extern tree_code minmax_from_comparison (tree_code, tree, - const widest_int, - const widest_int); + const widest_int &, + const widest_int &); extern tree_code minmax_from_comparison (tree_code, tree, tree, tree, tree); diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc index d0428d04684..574b109bad5 100644 --- a/gcc/ipa-cp.cc +++ b/gcc/ipa-cp.cc @@ -928,7 +928,8 @@ ipcp_bits_lattice::set_to_bottom () when switching state from TOP. */ bool -ipcp_bits_lattice::set_to_constant (widest_int value, widest_int mask) +ipcp_bits_lattice::set_to_constant (const widest_int &value, + const widest_int &mask) { gcc_assert (top_p ()); m_lattice_val = IPA_BITS_CONSTANT; @@ -985,7 +986,8 @@ ipcp_bits_lattice::get_value_and_mask (tree operand, widest_int *valuep, widest_ DROP_ALL_ONES, mask out any known bits with value one afterwards. */ bool -ipcp_bits_lattice::meet_with_1 (widest_int value, widest_int mask, +ipcp_bits_lattice::meet_with_1 (const widest_int &value, + const widest_int &mask, unsigned precision, bool drop_all_ones) { gcc_assert (constant_p ()); @@ -1008,7 +1010,8 @@ ipcp_bits_lattice::meet_with_1 (widest_int value, widest_int mask, described by <value, mask, sgn, precision. */ bool -ipcp_bits_lattice::meet_with (widest_int value, widest_int mask, +ipcp_bits_lattice::meet_with (const widest_int &value, + const widest_int &mask, unsigned precision) { if (bottom_p ()) diff --git a/gcc/ipa-cp.h b/gcc/ipa-cp.h index af1fe8f1e75..c22a74bb23f 100644 --- a/gcc/ipa-cp.h +++ b/gcc/ipa-cp.h @@ -199,7 +199,7 @@ public: bool top_p () const { return m_lattice_val == IPA_BITS_UNDEFINED; } bool constant_p () const { return m_lattice_val == IPA_BITS_CONSTANT; } bool set_to_bottom (); - bool set_to_constant (widest_int, widest_int); + bool set_to_constant (const widest_int &, const widest_int &); bool known_nonzero_p () const; bool set_recipient_only (); bool recipient_only_p () const {return m_recipient_only; } @@ -210,7 +210,7 @@ public: bool meet_with (ipcp_bits_lattice& other, unsigned, signop, enum tree_code, tree, bool); - bool meet_with (widest_int, widest_int, unsigned); + bool meet_with (const widest_int &, const widest_int &, unsigned); void print (FILE *); @@ -228,7 +228,7 @@ private: value is known to be constant. */ widest_int m_value, m_mask; - bool meet_with_1 (widest_int, widest_int, unsigned, bool); + bool meet_with_1 (const widest_int &, const widest_int &, unsigned, bool); void get_value_and_mask (tree, widest_int *, widest_int *); }; diff --git a/gcc/range-op.cc b/gcc/range-op.cc index 350548951f4..3a0e6ed05d1 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -2585,10 +2585,10 @@ operator_div::wi_fold (irange &r, tree type, const wide_int &lh_lb, const wide_int &lh_ub, const wide_int &rh_lb, const wide_int &rh_ub) const { - const wide_int dividend_min = lh_lb; - const wide_int dividend_max = lh_ub; - const wide_int divisor_min = rh_lb; - const wide_int divisor_max = rh_ub; + const wide_int ÷nd_min = lh_lb; + const wide_int ÷nd_max = lh_ub; + const wide_int &divisor_min = rh_lb; + const wide_int &divisor_max = rh_ub; signop sign = TYPE_SIGN (type); unsigned prec = TYPE_PRECISION (type); wide_int extra_min, extra_max; @@ -4288,7 +4288,7 @@ operator_bitwise_xor::wi_fold (irange &r, tree type, = (wi::bit_and_not (mustbe_nonzero_lh, maybe_nonzero_rh) | wi::bit_and_not (mustbe_nonzero_rh, maybe_nonzero_lh)); wide_int new_ub = ~result_zero_bits; - wide_int new_lb = result_one_bits; + const wide_int &new_lb = result_one_bits; // If the range has all positive or all negative values, the result // is better than VARYING. diff --git a/gcc/tree-ssa-ccp.cc b/gcc/tree-ssa-ccp.cc index cc1da6540e3..1345a065194 100644 --- a/gcc/tree-ssa-ccp.cc +++ b/gcc/tree-ssa-ccp.cc @@ -433,7 +433,8 @@ canonicalize_value (ccp_prop_value_t *val) /* Return whether the lattice transition is valid. */ static bool -valid_lattice_transition (ccp_prop_value_t old_val, ccp_prop_value_t new_val) +valid_lattice_transition (const ccp_prop_value_t &old_val, + const ccp_prop_value_t &new_val) { /* Lattice transitions must always be monotonically increasing in value. */ @@ -1626,7 +1627,7 @@ bit_value_binop (enum tree_code code, signop sgn, int width, is zero. */ if (r2mask == 0) { - widest_int shift = r2val; + const widest_int &shift = r2val; if (shift == 0) { *mask = r1mask; -- 2.53.0
