[llvm] [SandboxVec][LoadStoreVec][NFC] Extract vectorizeStores from runOnRegion (PR #215860)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 13:49:42 PDT 2026


================
@@ -64,14 +64,29 @@ void LoadStoreVec::tryEraseDeadInstrs(ArrayRef<Instruction *> Stores,
       PtrI->eraseFromParent();
 }
 
-bool LoadStoreVec::runOnRegion(Region &Rgn, const Analyses &A) {
-  SmallVector<Instruction *, 8> Bndl(Rgn.getAux().begin(), Rgn.getAux().end());
-  if (Bndl.size() < 2)
+/// Accepts the transaction if vectorizing was profitable, reverts it otherwise.
+/// \Returns true if the transaction was accepted.
+static bool acceptIfProfitable(Context &Ctx, const ScoreBoard &SB,
+                               InstructionCost CostBefore) {
----------------
vporpo wrote:

I don't like that we need to pass the ScoreBoard and CostBefore objects here.
The reason is that on the save side we are doing this inline but on the accept/revert case we are calling a function.

How about introducing a helper class that holds the necessary state in it. On the save side we would just do something like IRTransaction.save() and on the accept/revert side we would do IRTransaction.acceptOrRevert() without having to pass costs/SB.

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


More information about the llvm-commits mailing list