[PATCH] D111125: [NFC][LoopVectorize] Remove setBestPlan in favour of getBestPlanFor

Bardia Mahjour via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 8 08:19:13 PDT 2021


bmahjour added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h:315
+  /// Remove all VPlans except those containing one of the \p VFs.
+  void removePlansExcept(const ArrayRef<ElementCount> VFs) {
+    erase_if(VPlans, [VFs](const VPlanPtr &Plan) {
----------------
Instead of passing the list of VFs, why not pass in a `VPlanPtr` objects that's returned by `getBestPlanFor`? That would simplify the interface (since you don't have to pass in a list), simplifies the logic (since it makes it clear that we only delete plans that are not considered "best"), and avoids iterating through the list of VFs and VPlans a second time.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:8187
+LoopVectorizationPlanner::getBestPlanFor(ElementCount VF) const {
+  LLVM_DEBUG(dbgs() << "Getting best plan for VF=" << VF << '\n');
+
----------------
I'd suggest moving this debug line to the beginning of `executePlan` and keep outputting the interleave factor (`BestUF`).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111125/new/

https://reviews.llvm.org/D111125



More information about the llvm-commits mailing list