[PATCH] D90687: [LV] Ignore VF hint when unsafe

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 3 09:46:11 PST 2020


fhahn added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:5238
+  if (!VectorizerParams::isVFForced() && UserVF &&
+      UserVF > computeFeasibleMaxVF(TC)) {
+    reportVectorizationFailure(
----------------
dmgreen wrote:
> I don't think computeFeasibleMaxVF is the maximum safe width. It does a lot of things and is largely based on the backend vector widths. I'm guessing that's why so many tests are changing.
> 
> It should probably be based on Legal.getMaxSafeRegisterWidth()?
> It should probably be based on Legal.getMaxSafeRegisterWidth()?

computeFeasibleMaxVF should only return legal vectorization factors (using getMaxSafeRegisterWidht) I think. Given that we are free to ignore the hint, if it is not useful, why not just use the largest safe vectorization factors instead of bailing out?

Unfortunately the handling of UserVF is a bit of a mess, but I think it might be preferable to clamp the UserVF to the maximum vectorization factor in the caller of computeMaxVF where UserVF is actually used.


================
Comment at: llvm/test/Transforms/LoopVectorize/X86/libm-vector-calls.ll:192
 
-!71 = distinct !{!71, !72, !73}
-!72 = !{!"llvm.loop.vectorize.width", i32 4}
----------------
Why those test changes?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90687



More information about the llvm-commits mailing list