On 9/22/26 3:33 AM, [email protected] wrote:
From: Kyrylo Tkachov <[email protected]>
Late vsetvl PRE can insert a configuration on an edge from a shared
jump-table dispatch. Such an edge cannot be split for one dispatch
without also changing the other users of the table.
But I would expect that the common target has the same vector
configuration irrespective of how we got there. Hmm, at least the
element size, policies, etc. The count may be different though, so that
may be enough to force us to do something.
Keep the local configuration in blocks with incoming shared-table edges,
using the existing invalid_opt_bb_p check.
A checking RISC-V cross compiler with an audit-only shared-table hook
reproduced the rtl_split_edge ICE. The guard passed the RVV runtime test
at VLEN 128 and 256. The RISC-V hook is not enabled by this patch, so the
test does not exercise table sharing in the product configuration.
This patch was written by an AI agent as I don't feel familiar enough
with risc-v internals and I can't vouch for it. If the risc-v
maintainers want it I'm happy to commit it, of course.
Assisted-by: OpenAI Codex 5.6 Sol
gcc/ChangeLog:
PR middle-end/126236
* config/riscv/riscv-vsetvl.cc (invalid_opt_bb_p): Keep local
configurations in blocks with incoming shared-table edges.
gcc/testsuite/ChangeLog:
PR middle-end/126236
* gcc.target/riscv/rvv/vsetvl/pr126236.c: New test.
It generally looks sensible in that it just filters out more cases,
based on seeing the JUMP_TABLE_SHARED_P state. So OK if/when the
prereqs are accepted.
jeff