Page MenuHomePhabricator

[InstSimplify] Missed optimization in math expression: log10(pow(10.0,x)) == x, log2(pow(2.0,x)) == x
Needs ReviewPublic

Authored by Quolyk on Jan 11 2018, 2:07 AM.

Details

Summary

This patch enables folding following instructions under -ffast-math flag: log10(pow(10.0,x)) -> x, log2(pow(2.0,x)) -> x

Diff Detail

Event Timeline

Quolyk created this revision.Jan 11 2018, 2:07 AM
Quolyk updated this revision to Diff 135632.Feb 23 2018, 6:08 AM
lebedev.ri retitled this revision from [InstCombine] Missed optimization in math expression: log10(pow(10.0,x)) == x, log2(pow(2.0,x)) == x to [InstSimplify] Missed optimization in math expression: log10(pow(10.0,x)) == x, log2(pow(2.0,x)) == x.Mar 17 2018, 2:34 AM
lebedev.ri added reviewers: craig.topper, zvi, majnemer.
lebedev.ri set the repository for this revision to rL LLVM.
Quolyk updated this revision to Diff 155850.Jul 17 2018, 4:32 AM

Seems ok.

lib/Analysis/InstructionSimplify.cpp
4944

Hmm, do we want to canonicalize Intrinsic::pow(2.0, x) to exp2(x) instead ?