[PATCH] D98512: [LoopVectorize] Simplify scalar cost calculation in getInstructionCost

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 23 14:29:53 PDT 2021


fhahn accepted this revision.
fhahn added a comment.
This revision is now accepted and ready to land.

LGTM, thanks! Please wait a day or 2 with committing in case there are additional comments.



================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7245
+    Instruction *I, ElementCount VF) {
+  if (VF.isVector()) {
+    auto Scalarized = InstsToScalarize.find(VF);
----------------
nit: Change to have an early exit for `VF.isScalar`?


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7276
+    assert(I->getOpcode() == Instruction::GetElementPtr ||
+           hasSingleCopyAfterVectorization(I, VF));
+  } else
----------------
nit: I'd just define `hasSingleCopyAfterVectorization` as lambda here, because the comment already explains the intent.


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

https://reviews.llvm.org/D98512



More information about the llvm-commits mailing list