https://gcc.gnu.org/g:a4f81e168e02b0b1f8894070c6552b85672d4ee5

commit r15-9543-ga4f81e168e02b0b1f8894070c6552b85672d4ee5
Author: Hans-Peter Nilsson <h...@axis.com>
Date:   Tue Apr 15 06:08:36 2025 +0200

    combine: Correct comments about combine_validate_cost
    
    Fix misleading comments.  That function only determines whether
    replacements cost more; it doesn't actually *validate* costs as being
    cheaper.
    
    For example, it returns true also if it for various reasons cannot
    determine the costs, or if the new cost is the same, like when doing
    an identity replacement.  The code has been the same since
    r0-59417-g64b8935d4809f3.
    
            * combine.cc: Correct comments about combine_validate_cost.

Diff:
---
 gcc/combine.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/combine.cc b/gcc/combine.cc
index 5f085187cfef..e1186087dff4 100644
--- a/gcc/combine.cc
+++ b/gcc/combine.cc
@@ -815,7 +815,7 @@ do_SUBST_LINK (struct insn_link **into, struct insn_link 
*newval)
 #define SUBST_LINK(oldval, newval) do_SUBST_LINK (&oldval, newval)
 
 /* Subroutine of try_combine.  Determine whether the replacement patterns
-   NEWPAT, NEWI2PAT and NEWOTHERPAT are cheaper according to insn_cost
+   NEWPAT, NEWI2PAT and NEWOTHERPAT are more expensive according to insn_cost
    than the original sequence I0, I1, I2, I3 and undobuf.other_insn.  Note
    that I0, I1 and/or NEWI2PAT may be NULL_RTX.  Similarly, NEWOTHERPAT and
    undobuf.other_insn may also both be NULL_RTX.  Return false if the cost
@@ -4129,8 +4129,8 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, 
rtx_insn *i0,
        }
     }
 
-  /* Only allow this combination if insn_cost reports that the
-     replacement instructions are cheaper than the originals.  */
+  /* Reject this combination if insn_cost reports that the replacement
+     instructions are more expensive than the originals.  */
   if (!combine_validate_cost (i0, i1, i2, i3, newpat, newi2pat, other_pat))
     {
       undo_all ();

Reply via email to