[llvm] [TTI] Simplify implementation (NFCI) (PR #136674)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 22 11:05:34 PDT 2025


https://github.com/fhahn commented:

> > I don't expect any compile-time regressions/improvements here (there is still one virtual call).
> 
> I have often thought that the cost model dance is more difficult than helpful and thought recently of simplifying it. Does this mean that all calls between functions like AArch64TTIImpl::getIntrinsicInstrCost and functions in BasicTTIImplBase now go through a virtual dispatch, so need a vtable lookup and cannot be inlined and whatnot? Same for calls from BasicTTIImplBase -> AArch64TTIImpl methods or even AArch64TTIImpl -> AArch64TTIImpl. (Some of those directions might be helped by final, if that does anything useful).
> 
> That had been my guess for the reason, that you pay one virtual call to get into the getIntrinsicInstrCost functions, but none to calls once you were inside AArch64TTIImpl and the base classes. Honestly it might be worth removing if we don't see much benefit from it, but it would be nice if the cost model was efficient (to allow us to do other things with it). It might be worth checking, and maybe marking more of the target TTI implementations as final.


FWIW we now have a quite reliable way of getting a good idea of the compile-time impact via the compile-time-tracker ;) 


https://github.com/llvm/llvm-project/pull/136674


More information about the llvm-commits mailing list