https://gcc.gnu.org/g:3a055144c656454b75fda197d0bd5fd86e401a52

commit r17-5331-g3a055144c656454b75fda197d0bd5fd86e401a52
Author: linden <[email protected]>
Date:   Wed Oct 14 08:35:03 2026 +1300

    fold-const: take wide_int arguments by const reference
    
    minmax_from_comparison and fold_cmp_float_cst_p only read their
    widest_int and wide_int arguments, which are 80 bytes each on x86_64.
    Take them by const reference instead of by value; no functional change.
    
    gcc/ChangeLog:
    
            * fold-const.h (minmax_from_comparison, fold_cmp_float_cst_p):
            Take widest_int and wide_int arguments by const reference.
            * fold-const.cc (minmax_from_comparison, fold_cmp_float_cst_p):
            Likewise.
    
    Signed-off-by: linden <[email protected]>

Diff:
---
 gcc/fold-const.cc | 9 +++++----
 gcc/fold-const.h  | 8 ++++----
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc
index 03c395fad7b5..1fc4941b481a 100644
--- a/gcc/fold-const.cc
+++ b/gcc/fold-const.cc
@@ -197,8 +197,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)
     {
@@ -7138,9 +7138,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 ab03bf0aa35e..437d8ece0213 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);

Reply via email to