• Sebastian Graf's avatar
    Inline `integerDecodeDouble#` and constant-fold `decodeDouble_Int64#` instead · bc5de347
    Sebastian Graf authored
    Currently, `integerDecodeDouble#` is known-key so that it can be
    recognised in constant folding. But that is very brittle and doesn't
    survive worker/wrapper, which we even do for
    `NOINLINE` things since #13143.
    Also it is a trade-off: The implementation of `integerDecodeDouble#`
    allocates an `Integer` box that never cancels aways if we don't inline
    Hence we recognise the `decodeDouble_Int64#` primop instead in constant
    folding, so that we can inline `integerDecodeDouble#`. As a result,
    `integerDecodeDouble#` no longer needs to be known-key.
    While doing so, I realised that we don't constant-fold
    `decodeFloat_Int#` either, so I also added a RULE for it.
    `integerDecodeDouble` is dead, so I deleted it.
    Part of #18092. This improves the 32-bit `realToFrac`/`toRational`:
    Metric Decrease:
ConstantFold.hs 90.8 KB