[llvm] [VPlan] Extend CSE to eliminate GEPs (PR #156699)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 10 11:22:17 PDT 2025


================
@@ -1976,8 +1976,11 @@ struct VPCSEDenseMapInfo : public DenseMapInfo<VPSingleDefRecipe *> {
   static bool canHandle(const VPSingleDefRecipe *Def) {
     // We can extend the list of handled recipes in the future,
     // provided we account for the data embedded in them while checking for
-    // equality or hashing.
-    auto C = getOpcodeOrIntrinsicID(Def);
+    // equality or hashing. We assign VPVectorEndPointerRecipe the GEP opcode,
+    // as it is essentially a GEP with different semantics.
+    auto C = isa<VPVectorPointerRecipe>(Def)
----------------
fhahn wrote:

> This is very hard to test: if you look at what's being eliminated, it's mostly unrolled GEPs.

Is it? I think something like https://llvm.godbolt.org/z/3zvK7TTos should do

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


More information about the llvm-commits mailing list