[llvm] [VectorCombine] Prevent extract/ins rewrite to GEP (PR #150216)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 23 07:10:13 PDT 2025
dtcxzyw wrote:
> > Is there no TTI hook we can use?
>
> I don't thing there is a good hook from what I've seen.
>
> * GEP is "invalid" but used/tolerated.
> * SPIR-V has real issues with GEP/ptradd we need to solve (not this PR)
> * Reducing the number of GEP allows us to move a bit forward
>
> We might use `getGEPCost` and then set the cost to something very high in SPIR-V, but I feel this is just wrong: GEP are not expensive in SPIR-V, it's just LLVM lacks a robust type scavenging to correctly lower them. Hence why I've prefered to explicitely list the target in the transform: this is something specific for SPIR-V, and not because of cost/etc, but because of an actual LLVM/BE limitation.
For the same reason, we use `@llvm.preserve.*.access.index` instead of gep to preserve type information on BPF. Is it also suitable for SPIR-V?
https://github.com/llvm/llvm-project/pull/150216
More information about the llvm-commits
mailing list