[llvm] r179413 - CostModel: increase the default cost of supported floating point operations from 1 to two. Fixed a few tests that changes because now the cost of one insert + a vector operation on two doubles is lower than two scalar operations on doubles.

Eric Christopher echristo at gmail.com
Sun Apr 14 11:33:30 PDT 2013


On Sun, Apr 14, 2013 at 1:04 AM, Nadav Rotem <nrotem at apple.com> wrote:
>
> On Apr 12, 2013, at 2:51 PM, Eric Christopher <echristo at gmail.com> wrote:
>
> At some point something more than magic numbers would be good. Maybe
> an enum or something at least with some accompanying documentation as
> to how the magic numbers were gotten. :)
>
>
> Hi Eric,
>
> The BasicTargetTransformInfo needs to implement heuristics for estimating
> the costs of instructions.  For example, it needs to estimate the cost of
> instructions that the different backends mark as 'legal' or 'custom'.  At
> the moment the magic numbers in the code are accompanied by a comment.  I
> don't think that grouping all of these numbers into a single table/enum
> would make them more readable. Do you think that we should do something
> similar to InlineCost.h ? It has fewer parameters but the idea is the same.
>

Right, something like that for now would be fine. I.e. just a single
place for some magic constants. :)

The idea, I think ultimately, is that if you're looking at target
information is that each target will be describing things like "a
float is N times as costly as an integer instruction" since it'll vary
between targets. And if nothing else a single documented place for
magic constants is always appreciated when looking through code. "2?
Why's it 2? Why not 3? Why not pi?" and it makes any undocumented
constants stand out that much more.

Thanks!

-eric



More information about the llvm-commits mailing list