This is an archive of the discontinued LLVM Phabricator instance.

[TTI] Remove getCallCost
ClosedPublic

Authored by samparker on Mar 30 2020, 4:02 AM.

Details

Summary

getCallCost is only used within the different layers of TTI, with no backend implementing it, so fold the base implementation into getUserCost. I think this is an NFC.

Diff Detail

Event Timeline

samparker created this revision.Mar 30 2020, 4:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 30 2020, 4:02 AM
spatel added a subscriber: SjoerdMeijer.

It would be great if we can simplify this chunk, but I'm not sure of the history/plans. Adding @SjoerdMeijer based on the recent patch D59014.

This is a tricky one, because usually it is quite simpel: if code is not used, it should be deleted. However, estimating costs of e.g. libc functions is such a glaring omission, something we definitely should be doing, but we aren't very unfortunately. I had to switch tasks before I could finish D59129, but that is just one example how we could estimate costs.... So yeah, I don't know, if this is really bothering you, we can get rid of rid, but perhaps keeping this infrastructure isn't that bad?
Perhaps this is also a good motivation to pick up D59129 again on the side...

From what I can see from that patch, it's concerned with the cost of intrinsics only? It seems that the cost of intrinsics has been the only important thing to be used by TTI in general, and removing getCallCost shouldn't interfere with that. This patch still passes the User to getIntrinsicCost.

spatel accepted this revision.Mar 31 2020, 6:34 AM

LGTM - we're trying to reduce and fix the cost model mess, so I'm fine with this step. If we want to add non-intrinsic call cost modeling in the future, it can be done without much effort when necessary.

llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
865

Copy over the existing code comment to explain this?

// The target-independent implementation just measures the size of the
// function by approximating that each argument will take on average one
// instruction to prepare.
This revision is now accepted and ready to land.Mar 31 2020, 6:34 AM

Ah yes, it's getCallCost calling getIntrinsicCost, and this is about getCallCost, so agreed.

This revision was automatically updated to reflect the committed changes.