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.
Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.
Committed as trivial.
Thanks,
Tamar
gcc/ChangeLog:
* optabs.cc (emit_cmp_and_jump_insns): Check for non-single use.
---
diff --git a/gcc/optabs.cc b/gcc/optabs.cc
index
9882aac0ba9a377fcedfab2beb5871159e39bd02..0f1495545a496e9045f1a9d35b3b1385a80bc558
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)
{
--
diff --git a/gcc/optabs.cc b/gcc/optabs.cc
index 9882aac0ba9a377fcedfab2beb5871159e39bd02..0f1495545a496e9045f1a9d35b3b1385a80bc558 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)
{