[PATCH] D101836: [LoopVectorize] Enable strict reductions when allowReordering() returns false

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 4 13:38:10 PDT 2021


sdesmalen added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:9654-9655
+                                      LoopVectorizeHints &Hints) {
+   if (Hints.allowReordering())
+     return true;
+
----------------
nit: indentation, please use clang-format.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:9660
+
+  return (all_of(LVL.getReductionVars(), [&](auto &Reduction) -> bool {
+    RecurrenceDescriptor RdxDesc = Reduction.second;
----------------
Why do all of the reductions have to be ordered for the LV to be able to vectorize FP math?
(e.g. if there is an integer reduction and an ordered FP reduction, it would now choose not to vectorize based on this condition)


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:9783-9784
 
-  if (!Requirements.canVectorizeFPMath(Hints)) {
+  if (!Requirements.canVectorizeFPMath(Hints) &&
+      !canVectorizeOrderedFPMath(LVL, Hints)) {
     ORE->emit([&]() {
----------------
This condition is a bit odd. Should `canVectorizeOrderedFPMath` just contain the call to `Requirements.canVectorizeFPMath` instead? i.e. in order to vectorize ordered FP math, it must at least be able to vectorize FP math.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101836



More information about the llvm-commits mailing list