[PATCH] D74944: [LoopVectorize] Fix cost for calls to functions that have vector versions

Francesco Petrogalli via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 21 11:54:41 PST 2020


fpetrogalli added a comment.

Hi @nemanjai ,

thank you for updating the code.

Sorry for being picky, I think you should add another test. Your code need to work also for the `vector-function-avi-variant` attribute and not just for the `-vector-library=` option.

Kind regards,

Francesco



================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:3290
+  VFShape Shape = VFShape::get(*CI, {VF, false}, false /*HasGlobalPred*/);
+  auto *VecFunc = VFDatabase(*CI).getVectorizedFunction(Shape);
+
----------------
You should not use auto when the type is not obvious: http://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable

Please `s/auto/Function/`.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:3292
+
+  if (!TLI || CI->isNoBuiltin() || !VecFunc)
     return Cost;
----------------
Nit: I just noticed that also the `!TLI` condition can probably be removed?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74944





More information about the llvm-commits mailing list