tools/spirv_opt.py: both pinned_ids (main) and the SROA parameters (PR); main's id_type Result Type check kept after the PR's const_type check on null-zero loads; main's OpUndef/OpSpecConstant* const_type kept. tests/test_spirv_opt.py: both sets of new tests.
Co-authored-by: JARVIX <273200855+jarvixaiassistant-glitch@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Split non-escaped, statically indexed Function-scope arrays (such as
%vgpr[256] and %sgpr[128] when no dynamic v_movrel*/s_movrel* indexing
exists) into per-slot scalar OpVariables for only the live slots
referenced after dominator-tree forwarding and DCE, eliminating the
monolithic array allocas and their static OpAccessChains.
Preserves arrays with dynamic indices, whole-array loads/stores,
escapes, decorations, non-null initializers, or negative/out-of-bounds
static indices; canonicalizes signed/unsigned constant indices with
equal value and rewrites multi-index OpAccessChains cleanly.
Addresses standalone memory-aliasing review findings on PR #2298 (@duudiis):
- Signed/unsigned integer index canonicalization (%uint 0 vs %int 0) is already handled
by keying static OpAccessChain slots on const_int_val[i][1]; now also require every
static slot index to be in const_int_val (treating unparsed constants as dynamic).
- Mark any Function-scope variable touched by a Volatile OpLoad or OpStore as escaped
so volatile accesses never observe stale forwarded values or killed prior stores.
- Mark any Function-scope variable accessed at mixed aggregate/subobject slot depths
(e.g. both whole-array and element pointers) as escaped to prevent partial-overlap
aliasing.
- Add regression tests for all four cases in tests/test_spirv_opt.py.