[clang] [llvm] [SPIR-V] Default to NewPM (PR #239489)
Arseniy Obolenskiy via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 5 22:58:55 PST 2026
aobolensk wrote:
> Where exactly is the SPIRV backend used? I think there are some gaps I haven't finished up yet where `runCodeGenPipeline` isn't used, so we'll use the legacy pipeline by default (mainly in LTO I believe). I was hoping to get to those in the next couple of days. If it's just standard clang/the other SPIRV specific places you fixed, then this shouldn't be an issue.
>
> Also, how much does SPIRV care about LoopStrengthReduction? Enabling the NewPM currently causes optimization regressions, at least for CPU backends, due to LSR not really understanding LCSSA, which the NewPM enforces for loop pipelines. I've started landing patches to fix this, but won't expect it to be done for the next week or two. But given SPIRV is different in that it's virtual ISA, maybe this is a moot point?
It is used for OpenCL, HLSL, HIP, OpenMP from clang perspective, and SPIRVTranslate (MLIR)
The SPIR-V `-flto` link runs through llvm-lto: https://github.com/llvm/llvm-project/blob/4f2748f0ac25a1538e09d50f011c67ec828a205e/clang/lib/Driver/ToolChains/SPIRV.cpp#L196-L208
clang-sycl-linker and the offload JIT still use the legacy pipeline: https://github.com/llvm/llvm-project/blob/4f2748f0ac25a1538e09d50f011c67ec828a205e/clang/tools/clang-sycl-linker/ClangSYCLLinker.cpp#L657-L663 https://github.com/llvm/llvm-project/blob/4f2748f0ac25a1538e09d50f011c67ec828a205e/offload/plugins-nextgen/common/src/JIT.cpp#L174-L182
LoopStrengthReduction is not being run on SPIR-V
Anyway, I'd like to get more feedback from the different stakeholders, in case they have downstream projects that could be impacted by this change
https://github.com/llvm/llvm-project/pull/239489
More information about the cfe-commits
mailing list