]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ssa_operands: speed up GIMPLE_SWITCH handling
authorAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Fri, 15 May 2026 08:12:15 +0000 (01:12 -0700)
committerAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Fri, 15 May 2026 22:57:37 +0000 (15:57 -0700)
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.

gcc/ChangeLog:

* tree-ssa-operands.cc (operands_scanner::parse_ssa_operands):
Process index of the gswitch only.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
gcc/tree-ssa-operands.cc

index f9e347e8dbce6d3f4b3fe40773475c5fd40ff238..4c5c4ee8db92ca29a69a5ff6037a423fba7e1eac 100644 (file)
@@ -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));