[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:41:00 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) {
----------------
david-arm wrote:
> bmahjour wrote:
> > 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.
> I could do that, but would have to change this immediately in D109432 to accept a list of vplans, since in that patch different VFs will be in different plans. I would like to keep this as a list if possible. If you still think it's better to pass in a list of VPlanPtrs here instead of a list of VFs I can see if that makes the code simpler?
Ok, fair enough....I guess you could make it a list in this patch and pass a list of size one (just like you're doing now), but I still think that the type of the list element should be VPlanPtr.


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

https://reviews.llvm.org/D111125



More information about the llvm-commits mailing list