[llvm] [TTI] Simplify implementation (NFCI) (PR #136674)
Sergei Barannikov via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 22 11:48:33 PDT 2025
s-barannikov wrote:
> Do you have any idea why this design was used in the first place?
This design was introduced by 705b185f90a67b15922f7537f13944e74321f344. I'm not sure I fully understand the motivation, it mostly talks about benefits for the NewPM which I'm not familiar with.
> 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).
The honest answer -- I'm not sure. I hope there will be no compile time regressions, and if there are, I'm counting on `final`.
Here is how I see it:
`BasicTTIImplBase` still calls methods of a derived class via `thisT()->`. If that doesn't devirtualize the call, making the implementation `final` should help. I was hoping to remove the template base in a future patch if there is no compile time difference.
Adding `final` should also help in AArch64TTIImpl -> AArch64TTIImpl case; calling `TTIImpl` method from `TTI` always goes through a virtual dispatch (before/after this change).
> Looks like this has already managed to bitrot :)
Yeah, quicker than I expected. Should be easy to fix though.
https://github.com/llvm/llvm-project/pull/136674
More information about the llvm-commits
mailing list