[PATCH] D92177: [NFC][InstructionCost] Refactor LoopVectorizationCostModel::selectVectorizationFactor

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 27 00:56:07 PST 2020

david-arm added inline comments.

Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:5414
+  std::pair<float, unsigned> MinCost = {ExpectedCost, 1};
+  const float ScalarCost = ExpectedCost;
david-arm wrote:
> sdesmalen wrote:
> > `std::pair<unsigned, unsigned>` 
> This is no longer a NFC change if I use unsigned. This changes the behaviour of cases where different vectorisation factors produce fractional, and different, costs. For example, (float) 10 / 2 is less than (float) 11 / 2, whereas using integers would give the same result of 5. I don't mind making the change, but then I think I should remove NFC from the subject line.
I think what I can do keep it as NFC is simultaneously change float->unsigned and change the algorithm in isLowerVectorCost() to do the same as the dependent patch - D92178. That way we'd still make the same choice of VF as before.

  rG LLVM Github Monorepo



More information about the llvm-commits mailing list