[PATCH] D128302: [AArch64][CostModel] Detects that ExtractElement at index is not free in AArch64 when result is used as integer.
Mingming Liu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 13 13:28:13 PDT 2022
mingmingl marked an inline comment as done.
mingmingl added inline comments.
================
Comment at: llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h:176
+ using BaseT::getVectorInstrCost;
InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val,
----------------
davidxl wrote:
> mingmingl wrote:
> > davidxl wrote:
> > > what is the purpose of the using statement here?
> > Oh good catch. This is a mistake. 'using statement' is not needed for AArch64 since there is an override for new interface.
> Is it needed for other targets? The new method is a public method in BasicTTIImplBase, which is inherited and visible in the derived class.
> Is it needed for other targets?
Yes, and I learnt it by seeing the compile error without 'using statements'.
Basically, the overloaded method in derived class could hide method in the base class, even if function signature is different. There is [[ http://shortn/_h4uJzntegh | one example ]], and one relevant [[ https://stackoverflow.com/questions/28590103/crtp-vs-name-hiding-for-static-polymorphism | discussion ]].
Also, renaming the new interface differently also compiles, since name hiding doesn't exist by renaming.
There are `using BaseT::getIntImmCost` statements in <Target>TargetTransformInfo.cpp ([[ https://github.com/llvm/llvm-project/blob/2cf320d41ed708679e01eeeb93f58d6c5c88ba7a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h#L73 | example ]]) (not sure if 'getIntImmCost' still helps with name hiding now, since overtime many targets overload the method with the same function signature)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D128302/new/
https://reviews.llvm.org/D128302
More information about the llvm-commits
mailing list