[PATCH] D102253: [LV] Prevent vectorization with unsupported element types.

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 30 08:06:48 PDT 2021


david-arm added a comment.

I think the new changes look good @kmclaughlin! Just a couple more minor comments.



================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:6284
   const DataLayout &DL = TheFunction->getParent()->getDataLayout();
+  for (Type *T : ElementTypesInLoop) {
+    MinWidth = std::min<unsigned>(
----------------
If we're relying upon the element types being collected for correctness here is it worth adding an assert:

  assert(!ElementTypesInLoop.empty() && "Unable to calculate smallest and widest types");


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:6293
 
+void LoopVectorizationCostModel::collectAllElementTypesInLoop() {
   // For each block.
----------------
Do we ever call this function more than once for a given loop? I wonder if it's worth clearing the list at the start just in case, i.e.

  ElementTypesInLoop.clear();



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

https://reviews.llvm.org/D102253



More information about the llvm-commits mailing list