[PATCH] D96021: [LoopVectorize] NFC: Move UserVF feasibility checks to separate function.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 18 00:59:12 PST 2021


fhahn added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:1647
+  /// \return UserVF if it is non-zero and there are no dependences, otherwise
+  /// return a clamped value. For a scalable UserVF, the resulting feasible VF
+  /// may be fixed-width.
----------------
it also checks if the reductions are supported for scalable vectors, right? Probably better to not go into the specifics in the comment and just say `\return UserVF directly if it is valid. Otherwise clamp UserVF to the largest valid value.`


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:5572
+    if (!MaybeMaxVF)
+      MaybeMaxVF = computeFeasibleMaxVF(TC, SmallestType, WidestType);
+
----------------
nit: the code might be slightly easier to follow if you just directly return if there is a valid UserVF, like

```
// If there is a valid UserVF, use it.
if (auto UserVF = computeFeasibleUserVF(...))`
   return UserVF.getValue();

return computeFeasibleMaxVF()
```


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

https://reviews.llvm.org/D96021



More information about the llvm-commits mailing list