This is an archive of the discontinued LLVM Phabricator instance.

[ConstantFolding] Fold constant calls to log2()
ClosedPublic

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

Details

Diff Detail

Repository
rL LLVM

Event Timeline

evandro created this revision.Sep 6 2019, 1:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 6 2019, 1:31 PM
This revision is now accepted and ready to land.Sep 6 2019, 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...

This revision was automatically updated to reflect the committed changes.