[PATCH] D37471: [TTI] Implement getCastInstrCost

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 6 06:03:24 PDT 2017


hfinkel added a comment.

In https://reviews.llvm.org/D37471#862029, @samparker wrote:

> Hi Hal,
>
> Thanks for questions. I have to admit that I've been confused by how TTI is implemented, it seems rather convoluted to me. I've removed my previous change and, instead, I've reorganised some of the logic in TargetTransformInfoImplBase which hopefully makes sense.


It doesn't, likely, but as there's no documentation explicitly explaining this, it's not obvious why. TTI has two cost models right now: First is the "user cost" model, which is used by the inliner, loop unroller, etc. which provides some combination of code size and expense. The second is the model (mainly) used by the vectorizers, and it measures reciprocal throughput. getCastInstrCost is part of the latter model and getUserCost/getOperationCost are part of the former.

That doesn't mean that tying the models together in this way doesn't make sense, it might, but we'd need to be explicit about what we're doing on why. If we don't want to do that here, you should keep the implementations separate.

What problem are you trying to solve?

> I can see that implementing isTruncateFree in the ARM backend should also solve my problem and I will look into that next.
> 
> Thanks,
> sam




https://reviews.llvm.org/D37471





More information about the llvm-commits mailing list