[PATCH] D79941: [NFCI][CostModel] Refactor getIntrinsicInstrCost
Daniil Fukalov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 19 08:41:39 PDT 2020
dfukalov added a comment.
I like the idea to simplify cost model implementation since it was not trivial to make even a small changes.
================
Comment at: llvm/include/llvm/Analysis/TargetTransformInfo.h:153-154
+ unsigned getScalarizationCost() const { return ScalarizationCost; }
+ SmallVectorImpl<Value *> &getArgs() { return Arguments; }
+ SmallVectorImpl<Type *> &getArgTypes() { return ParamTys; }
+
----------------
Regarding the way previous implementation used arrays of types and args, it seems these two functions can return references to const vectors and may be const too?
================
Comment at: llvm/include/llvm/Analysis/TargetTransformInfo.h:1052
int getIntrinsicInstrCost(
- Intrinsic::ID ID, Type *RetTy, ArrayRef<Value *> Args,
- FastMathFlags FMF, unsigned VF = 1,
- TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput,
- const Instruction *I = nullptr) const;
-
- /// \returns The cost of Intrinsic instructions. Types analysis only.
- /// If ScalarizationCostPassed is UINT_MAX, the cost of scalarizing the
- /// arguments and the return value will be computed based on types.
- /// I is the optional original context instruction holding the call to the
- /// intrinsic
- int getIntrinsicInstrCost(
- Intrinsic::ID ID, Type *RetTy, ArrayRef<Type *> Tys, FastMathFlags FMF,
- unsigned ScalarizationCostPassed = UINT_MAX,
- TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput,
- const Instruction *I = nullptr) const;
+ IntrinsicCostAttributes &ICA,
+ TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput) const;
----------------
And almost the same question as previous: are these structures intended to be modifiable?
Perhaps, if there are no plans to use them to pass data back from calls, these references should be const too?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79941/new/
https://reviews.llvm.org/D79941
More information about the llvm-commits
mailing list