[SPIRV] Fix regression from e4c30c15c87f - skip expanding __spirv_ocl_printf
Commit e4c30c15c87f added ExpandVariadics pass which packs variadic function
arguments into struct buffers. This broke __spirv_ocl_printf in SPIRV backend
because the backend was passing struct pointers to OpExtInst printf, but printf
expects individual scalar value operands.
Fix by skipping __spirv_ocl_printf functions in ExpandVariadics pass, allowing
them to remain truly variadic and work with the SPIRV backend's native printf
handling. This is a targeted revert that only affects SPIRV printf functions
while keeping ExpandVariadics enabled for other variadic functions.
Also add defensive bounds checking in SPIRVModuleAnalysis to prevent crashes
when OpExtInst instructions have fewer operands than expected.
Fixes:
- Printf/char.cpp
- Printf/float.cpp
- Printf/double.cpp
- DeviceLib/built-ins/printf.cpp
- ThreadSanitizer/check_access16.cpp (no longer crashes)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>