[llvm-branch-commits] [llvm] [SPIRV] Do not eliminate `OpPointerType` even if unused (PR #182551)

Steven Perron via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Feb 23 06:39:02 PST 2026


https://github.com/s-perron commented:

One of the reasons I added the code to remove the unused types is because keeping the types around can cause invalid SPIR-V.

For example, the llvm-ir may contain vectors with a large number of elements that then gets legalized. If we do not remove long vector type, then the spir-v will not validate.

This PR could indirectly keep the invalid types around. If there is a pointer to a longer vector type, then the pointer type will be kept, and so will the vector type.

Can you describe what other solutions you considered? We should try to move away from keeping instructions around because they may get used, and creating the instructions when they are needed if they do not exist.

https://github.com/llvm/llvm-project/pull/182551


More information about the llvm-branch-commits mailing list