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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 15 02:48:37 PDT 2025


================
@@ -1978,20 +1978,39 @@ struct VPCSEDenseMapInfo : public DenseMapInfo<VPSingleDefRecipe *> {
     return TypeSwitch<const VPSingleDefRecipe *,
                       std::optional<std::pair<bool, unsigned>>>(R)
         .Case<VPInstruction, VPWidenRecipe, VPWidenCastRecipe,
-              VPWidenSelectRecipe, VPReplicateRecipe>(
+              VPWidenSelectRecipe, VPWidenGEPRecipe, VPReplicateRecipe>(
             [](auto *I) { return std::make_pair(false, I->getOpcode()); })
         .Case<VPWidenIntrinsicRecipe>([](auto *I) {
           return std::make_pair(true, I->getVectorIntrinsicID());
         })
         .Default([](auto *) { return std::nullopt; });
   }
 
+  /// If recipe \p R will lower to a GEP with a non-trivial source element type,
+  /// return that source element type.
----------------
fhahn wrote:

What does non-trivial mean here? Other than `i8`? If so, better to spell this out

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


More information about the llvm-commits mailing list