[llvm] [VPlan] Introduce CSE pass (PR #151872)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 13 13:32:35 PDT 2025


================
@@ -1772,6 +1772,93 @@ void VPlanTransforms::clearReductionWrapFlags(VPlan &Plan) {
   }
 }
 
+namespace {
+struct VPCSEDenseMapInfo : public DenseMapInfo<VPSingleDefRecipe *> {
+  static bool isSentinel(const VPSingleDefRecipe *Def) {
+    return Def == getEmptyKey() || Def == getTombstoneKey();
+  }
+
+  /// Get any instruction opcode or intrinsic ID data embedded in recipe \p R.
+  /// Returns an optional pair, where the first element indicates whether it is
+  /// an intrinsic ID.
+  static std::optional<std::pair<bool, unsigned>>
+  getOpcodeOrIntrinsicID(const VPRecipeBase &R) {
----------------
fhahn wrote:

Can pass VPSingleDefRecipe here?

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


More information about the llvm-commits mailing list