[PATCH] D21251: [TTI] The cost model should not assume illegal vector casts get completely scalarized

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 22 18:35:59 PDT 2016


arsenm added a comment.

In http://reviews.llvm.org/D21251#462734, @mkuper wrote:

> Updated to not affect AMDGPU, by specializing the "split cost".
>
> Unfortunately, we can't just plug in getVectorSplitCost() (either this or a more sophisticated version) into getTypeLegalizationCost().
>
> This is because most of the users of getTypeLegalizationCost() apparently don't use the returned value as a "cost". Rather, they seem assume it's just the number of post-legalization pieces, and multiply per-piece costs by that. So that needs a completely separate clean-up first. 
>  AMDGPU itself is also guilty of this - it multiplies by getTypeLegalizationCost().first, so if getTypeLegalizationCost(LegalType) were to return 0 - which it ought to, if we really consider it the "cost" of legalization - things would get seriously out of whack. But this happens across all targets.


I was thinking that was to get the cost of the split. Everything should be cost * NElts * scalar cost, so e.g. <8 x float> -> <4 x float>, <4 x float> = 2 * 4 * cost


http://reviews.llvm.org/D21251





More information about the llvm-commits mailing list