> Am 15.05.2026 um 18:58 schrieb Andrew Pinski <[email protected]>:
>
> The operands of a GIMPLE_SWITCH is index, followed by the cases.
> The cases are all CASE_LABEL_EXPR which are skipped via
> operands_scanner::get_expr_operands
> anyways so we only need to scan the index operand.
> This also the first step in changing GIMPLE_SWITCH slightly.
Ok
Richard
> gcc/ChangeLog:
>
> * tree-ssa-operands.cc (operands_scanner::parse_ssa_operands):
> Process index of the gswitch only.
>
> Signed-off-by: Andrew Pinski <[email protected]>
> ---
> gcc/tree-ssa-operands.cc | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/gcc/tree-ssa-operands.cc b/gcc/tree-ssa-operands.cc
> index f9e347e8dbc..4c5c4ee8db9 100644
> --- a/gcc/tree-ssa-operands.cc
> +++ b/gcc/tree-ssa-operands.cc
> @@ -976,6 +976,12 @@ operands_scanner::parse_ssa_operands ()
> append_vuse (gimple_vop (fn));
> goto do_default;
>
> + /* Switch index is the only operand that matters. */
> + case GIMPLE_SWITCH:
> + get_expr_operands (gimple_switch_index_ptr (as_a <gswitch*> (stmt)),
> + opf_use);
> + break;
> +
> case GIMPLE_CALL:
> /* Add call-clobbered operands, if needed. */
> maybe_add_call_vops (as_a <gcall *> (stmt));
> --
> 2.43.0
>