[PATCH] D11741: [TTI] Make the cost APIs in TargetTransformInfo consistently use 'int' rather than 'unsigned' for their costs.

Chandler Carruth chandlerc at gmail.com
Mon Aug 3 17:40:59 PDT 2015


chandlerc added a comment.

In http://reviews.llvm.org/D11741#217335, @sanjoy wrote:

> I have two comments:
>
> - I'd be scared of existing code that returns `-1` to mean "very expensive".  Now that same value means "cheaper than free".  I think these should be fixed, but is there a way to automatically flush these out?


Probably, I think I can add some asserts to check for this. But I've also read through most of this code and don't see anyone doing that. Still, better to check.

> - Do you intend to add callbacks that actually return negative costs?  Or is this meant to make intermediate computation more ergonomic?


The latter. In particular, I have seen several cases where we might reasonably wrap up computation or aggregated calls to this API and return a potentially negative number. With aggregation this becomes more more believable. And it is quite awkward to force such code to switch types suddenly.


http://reviews.llvm.org/D11741







More information about the llvm-commits mailing list