[llvm] [SandboxVec][LoadStoreVec] Dispatch runOnRegion on seed kind (PR #215944)

Anshil Gandhi via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 2 21:47:05 PDT 2026


================
@@ -35,14 +36,35 @@ class LLVM_ABI LoadStoreVec final : public RegionPass {
   std::optional<Type *> canVectorize(ArrayRef<Instruction *> Bndl,
                                      Scheduler &Sched);
 
-  void tryEraseDeadInstrs(ArrayRef<Instruction *> Stores,
-                          ArrayRef<Value *> Operands);
+  /// Erases each instruction in \p Bndl -- the store or load bundle just
+  /// replaced by a new vector value -- that has no remaining uses, plus each
+  /// load in \p MaybeDeadOperands that likewise has no remaining uses (an
+  /// operand isn't necessarily single-use, e.g. a packed operand, see
+  /// packOperands()). A store in \p Bndl is always dead, since it never
+  /// produced a value in the first place; a load in \p Bndl (a top-level
+  /// seed load) is only erased once it truly has no uses left, which
+  /// vectorizeLoads() guarantees by unpacking every use first. Also cleans
+  /// up any pointer-operand GEP that becomes dead as a result.
+  void eraseDeadAfterVectorize(ArrayRef<Instruction *> Bndl,
+                               ArrayRef<Value *> MaybeDeadOperands);
+
+  /// Builds a single vector load out of the loads in \p Operands. \Returns
+  /// the new load, or nullptr if \p Operands are not a vectorizable load
+  /// chain. Used only by vectorizeLoads(), for a load-kind seed slice.
+  Value *createVectorLoad(ArrayRef<Value *> Operands, Scheduler &Sched,
+                          const Analyses &A, Context &Ctx);
 
   /// Tries to vectorize the store chain \p Bndl into a single vector store.
   /// \Returns whether it succeeded.
   bool vectorizeStores(ArrayRef<Instruction *> Bndl, Region &Rgn,
                        Scheduler &Sched, const Analyses &A);
 
+  /// Tries to vectorize the load chain \p Bndl into a single vector load,
+  /// replacing each original load's uses with an extract from it.
+  /// \Returns whether it succeeded.
+  bool vectorizeLoads(ArrayRef<Instruction *> Bndl, Region &Rgn,
----------------
gandhi56 wrote:

Yup, sounds good. I will add a TODO.

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


More information about the llvm-commits mailing list