https://gcc.gnu.org/g:b11ae5fb5efcf9e0977cd54538765e1d40b1b107
commit r16-5635-gb11ae5fb5efcf9e0977cd54538765e1d40b1b107 Author: Tamar Christina <[email protected]> Date: Wed Nov 26 22:00:07 2025 +0000 middle-end: guard against non-single use compares in emit_cmp_and_jump_insns When I wrote this optimization my patch stack included a change in tree-out-of-ssa that would duplicate the compares such that the use is always single use and get_gimple_for_ssa_name would always succeed. However I have dropped that for GCC 16 since I didn't expect the vectorizer to be able to produce duplicate uses of the same compare results. But I neglected that you can get it by other means. So this simply checks that get_gimple_for_ssa_name succeeds for the LEN cases. The non-LEN cases already check it earlier on. To still get the optimization in this case the tree-out-of-ssa change is needed, which is staged for next stage-1. gcc/ChangeLog: * optabs.cc (emit_cmp_and_jump_insns): Check for non-single use. Diff: --- gcc/optabs.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/optabs.cc b/gcc/optabs.cc index 9882aac0ba9a..0f1495545a49 100644 --- a/gcc/optabs.cc +++ b/gcc/optabs.cc @@ -4895,7 +4895,8 @@ emit_cmp_and_jump_insns (rtx x, rtx y, enum rtx_code comparison, rtx size, } enum insn_code icode; - if (is_gimple_assign (def_stmt) + if (def_stmt + && is_gimple_assign (def_stmt) && TREE_CODE_CLASS (gimple_assign_rhs_code (def_stmt)) == tcc_comparison) {
