[llvm] [SPIR-V] Add pre-headers to loops. (PR #75844)
Nathan Gauër via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 19 05:59:59 PST 2023
Keenuts wrote:
> @Keenuts , do you think we should structure CFG for all SPIR-V flavors (both graphics and OpenCL)? If not, we probably need to call removeImplicitFallthroughs() and run createLoopSimplifyPass, checking for some flag or extension (or maybe isOpenCLEnv() from SPIRVSubtarget)?
You are right, I should gate the added pass with a `isVulkanEnv()` check. But for the fallthrough fix, I do think OpenCL could also benefit from it:
Right not, there is a check in `SPIRVInstructionSelector.cpp:1470` which handled fall-through blocks, but because it relies on the InstructionSelector to be called, it only works on non-empty basic blocks. When optimizations like loop-simplify are called (which happens even without this change), an empty basic block could be generated.
https://github.com/llvm/llvm-project/pull/75844
More information about the llvm-commits
mailing list