[PATCH] D90554: [CostModel] remove cost-kind predicate for intrinsics in basic TTI implementation

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 14 06:03:09 PST 2020


spatel added a comment.

In D90554#2393645 <https://reviews.llvm.org/D90554#2393645>, @spatel wrote:

> In D90554#2393351 <https://reviews.llvm.org/D90554#2393351>, @mstorsjo wrote:
>
>> In D90554#2385414 <https://reviews.llvm.org/D90554#2385414>, @spatel wrote:
>>
>>> Thanks, all!
>>> It's almost inevitable that some target will regress on some intrinsic with this change, so I'll be watching for fallout.
>>
>> I noticed a change in behaviour due to this commit - on ARM and AArch64, for cases involving the log2 intrinsic - previously, llvm was able to evaluate a big pile of code to deduce that a comparison involving log2 always is true, but after this change, it no longer does that. Is that something you want to have a look into, or is that expected? I wouldn't classify it as a bug in itself, as the code does what it's supposed to, it just optimizes differently than before.
>
> If you can reduce a test that shows the difference, that would be great. I'm not sure which pass was responsible for the optimization. 
> My first guess is that we should create a basic class size-cost exception for all of the scalar intrinsics that correspond to libm functions.

First guess was close - the C example should be restored with:
8ec7ea3d <https://reviews.llvm.org/rG8ec7ea3ddce7379e13e8dfb4a5260a6d2004aa1c>
Unrolling/inlining are always going to be tricky, so we will likely see other examples like that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90554/new/

https://reviews.llvm.org/D90554



More information about the llvm-commits mailing list