From: Vineet Gupta Date: Mon, 22 Dec 2025 16:52:33 +0000 (-0800) Subject: ifcvt: cond zero arith: re-expand output pattern [NFC] X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=817b03a2fb85cb6a934b06122ca261b07b70b824;p=thirdparty%2Fgcc.git ifcvt: cond zero arith: re-expand output pattern [NFC] Current code assigns the new czero insn into XEXP(a, 0) which feels like a kludge. Instead use expand_simple_binop to recreate it. gcc/ChangeLog: * ifcvt.cc (noce_try_cond_zero_arith): Use expand_simple_binop to re-expand the final pattern. Signed-off-by: Vineet Gupta --- diff --git a/gcc/ifcvt.cc b/gcc/ifcvt.cc index 486bf16ea16..ef59a93e987 100644 --- a/gcc/ifcvt.cc +++ b/gcc/ifcvt.cc @@ -3236,20 +3236,19 @@ noce_try_cond_zero_arith (struct noce_if_info *if_info) target = expand_simple_binop (mode, IOR, a_bin, target, if_info->x, 0, OPTAB_WIDEN); - if (!target) - goto end_seq_n_fail; - - if (target != if_info->x) - noce_emit_move_insn (if_info->x, target); } else { - if (REG_P (XEXP (a, 1))) - XEXP (a, 1) = target; - - noce_emit_move_insn (if_info->x, a); + target = expand_simple_binop (mode, op, a_op0, target, if_info->x, 0, + OPTAB_WIDEN); } + if (!target) + goto end_seq_n_fail; + + if (target != if_info->x) + noce_emit_move_insn (if_info->x, target); + seq = end_ifcvt_sequence (if_info); if (!seq || !targetm.noce_conversion_profitable_p (seq, if_info)) goto fail;