[PATCH] D30653: [LV] Refactor Cost Model's selectVectorizationFactor(), driven by a LoopVectorizationPlanner
Michael Kuperstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 6 13:12:03 PST 2017
mkuper added inline comments.
================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:6163
-LoopVectorizationCostModel::VectorizationFactor
-LoopVectorizationCostModel::selectVectorizationFactor(bool OptForSize) {
- // Width 1 means no vectorize
- VectorizationFactor Factor = {1U, 0U};
- if (OptForSize && Legal->getRuntimePointerChecking()->Need) {
+unsigned LoopVectorizationCostModel::computeMaxVFOrFail(bool OptForSize) {
+ const unsigned Fail = 0;
----------------
Any reason not to use Optional<> instead?
================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:7385
+ DEBUG(dbgs() << "LV: Using user VF " << UserVF << ".\n");
+ if (UserVF == 1)
+ return {UserVF, 0};
----------------
Maybe:
```
DEBUG(dbgs() << "LV: Using user VF " << UserVF << ".\n");
assert(isPowerOf2_32(UserVF) && "VF needs to be a power of two");
if (UserVF != 1)
CM.selectUserVectorizationFactor(UserVF);
return {UserVF, 0}
```
?
(I think isPowerOf2_32(1) is true.)
https://reviews.llvm.org/D30653
More information about the llvm-commits
mailing list