[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] ifcvt: Allow non-comparisons against 0 in noce_try_cond_zero_arith

Jeff Law law@gcc.gnu.org
Sat Jan 17 07:28:42 GMT 2026


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

commit d4d592b6dcc6b92f79dfd292dad07c5b2b65063f
Author: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Date:   Sun Dec 28 12:50:12 2025 -0800

    ifcvt: Allow non-comparisons against 0 in noce_try_cond_zero_arith
    
    Like r16-6332-g2a84a753afcf37 but instead of just allowing any comparisons
    against 0, this allows all comparisons. I mentioned this in
    https://gcc.gnu.org/pipermail/gcc-patches/2025-December/704463.html.
    
    gcc/ChangeLog:
    
            * ifcvt.cc (noce_try_cond_zero_arith): Remove restriction on comparison
            against 0.
    
    Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
    (cherry picked from commit cc515677b95d292d619c1fe6748a0d91385ca3ff)

Diff:
---
 gcc/ifcvt.cc | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/gcc/ifcvt.cc b/gcc/ifcvt.cc
index e2f98fbd5fbc..36ba65286ff9 100644
--- a/gcc/ifcvt.cc
+++ b/gcc/ifcvt.cc
@@ -3160,9 +3160,6 @@ noce_try_cond_zero_arith (struct noce_if_info *if_info)
   if (!noce_simple_bbs (if_info))
     return false;
 
-  if (!REG_P (XEXP (cond, 0)) || !rtx_equal_p (XEXP (cond, 1), const0_rtx))
-    return false;
-
   a = copy_rtx (if_info->a);
   b = copy_rtx (if_info->b);


More information about the Gcc-cvs mailing list