[PATCH] D94065: [NFC] Make remaining cost functions in LoopVectorize.cpp use InstructionCost

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 6 07:48:44 PST 2021


david-arm added a comment.

Hi @CarolineConcatto, I wasn't sure whether I needed to change computePredInstDiscount because I've assumed (possibly wrongly!) that we shouldn't be encountering invalid discounts (costs). At the end of computePredInstDiscount  it calls *Discount.getValue(), which will assert if the cost is invalid so there is some protection. When we add scalable vector support I doubt we can even call this function in it's current form because we know the scalarisation overhead will always be invalid.



================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:4876
+  InstructionCost CallCost = Cost->getVectorCallCost(CI, VF, NeedToScalarize);
+  InstructionCost IntrinsicCost = InstructionCost::getInvalid();
+  if (ID)
----------------
CarolineConcatto wrote:
> Is it necessary to set IntrinsicCost here?
Possibly? I think you're right that if UseVectorIntrinsic is true then IntrinsicCost must be well-defined. Just not sure if the compiler will warn about unitialized values.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94065



More information about the llvm-commits mailing list