llvm-project
c487e248 - [SPIR-V] Fix environment resolution causing legalization crash (#179052)

Commit
1 day ago
[SPIR-V] Fix environment resolution causing legalization crash (#179052) When the triple is spirv-unknown-unknown, SPIRVSubtarget::Env starts as Unknown and was set via const_cast in SPIRVCallLowering when the first entry point was lowered. This is too late: SPIRVLegalizerInfo has already been constructed with, for example, the wrong vector size limits, causing a crash (at best) or invalid SPIR-V generation. Resolve the environment early in SPIRVPrepareFunctions::runOnModule() by scanning the module for "hlsl.shader" attributes. Reinitialize the legalizer and extended instruction sets after resolution. Remove the const_cast lazy setting from SPIRVCallLowering. Fixes: https://github.com/llvm/llvm-project/issues/171898
Author
Parents
Loading