Page MenuHomePhabricator

[ConstantFolding] Fold constant calls to log2()

Authored by evandro on Fri, Sep 6, 1:31 PM.



Somehow, folding calls to log2() with a constant was missing.

Diff Detail

Event Timeline

evandro created this revision.Fri, Sep 6, 1:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptFri, Sep 6, 1:31 PM
This revision is now accepted and ready to land.Fri, Sep 6, 2:08 PM

I'm not really happy with adding more uses of ConstantFoldFP/ConstantFoldBinaryFP; they're flawed because they produce results that depend on the host's libm implementation. But I guess there isn't any reason to support log and not log2.

@efriedma, yes, I noticed that and noted it in rL371236.

I think a few of the functions we use ConstantFoldFP with actually already have implementations in APFloat: floor, ceil, round, fabs, fmod.

I'm not sure "C99" is really relevant; I don't think we support any hosts which don't have C99 libm, anyway.

@efriedma, I never know what Windows supports or not...