[PATCH] D80870: [LV] Make sure smallest/widest type sizes are powers-of-2.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 1 14:05:49 PDT 2020


fhahn marked 6 inline comments as done.
fhahn added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:5062
   // Ensure MaxVF is a power of 2; the dependence distance bound may not be.
   WidestRegister = PowerOf2Floor(WidestRegister);
 
----------------
Ayal wrote:
> Rounding WidestRegister down to a power of 2 is no longer needed; rounding-down MaxVectorSize alone suffices to ensure the method returns a power of 2.
Right, the only other use to compute the loop bound below should be fine.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:5122
   }
-  return MaxVF;
+  return PowerOf2Floor(MaxVF);
 }
----------------
Ayal wrote:
> This should be redundant; i.e., at this point MaxVF can be asserted to be a power of 2. Only way it might not be is because of getMinimumVF(), which, being a minimum, should probably not be rounded down silently (see above comment).
> This should be redundant; i.e., at this point MaxVF can be asserted to be a power of 2. Only way it might not be is because of getMinimumVF(), which, being a minimum, should probably not be rounded down silently (see above comment).

Right. Otherwise I am sure some test case will surface, which can then be added :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80870





More information about the llvm-commits mailing list