[llvm] [VectorCombine] Prevent extract/ins rewrite to GEP (PR #150216)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 23 06:53:24 PDT 2025


Keenuts 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.

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


More information about the llvm-commits mailing list