This is an archive of the discontinued LLVM Phabricator instance.

[InstSimplify] allow exp/log simplifications with only 'reassoc' FMF

Authored by spatel on Feb 10 2018, 8:56 AM.



As discussed on llvm-dev recently, we should refine our FP transforms based on the minimum subset of fast-math-flags needed to enable those transforms.

These intrinsic folds were just added with D41381, but we let them slide with isFast(). I think 'reassoc' is enough given that we're just eliminating ops based on their math inverses.

Diff Detail


Event Timeline

spatel created this revision.Feb 10 2018, 8:56 AM

Code change LGTM. A minor tweak to each test-change (to replace 'fast' with 'reassoc') would test it more precisely.

22 ↗(On Diff #133753)

'reassoc' instead of 'fast' should also be all that's needed for the llvm.log.f64 call to enable this transformation.

22 ↗(On Diff #133753)

Again, 'reassoc' is all that's needed.

22 ↗(On Diff #133753)

'reassoc' is all that's needed here, too.

22 ↗(On Diff #133753)

One last one where 'reassoc' is all that's needed.

spatel added inline comments.Feb 12 2018, 11:47 AM
22 ↗(On Diff #133753)

Hmm...looking a bit closer, this test doesn't add much value. We show that the FMF on the first instruction is irrelevant in the next test (and the same is true in each file). Should I just delete this and its siblings?

wristow added inline comments.Feb 12 2018, 2:24 PM
22 ↗(On Diff #133753)

Now that you mention it, yes, that makes more sense.

This revision was not accepted when it landed; it landed in state Needs Review.Feb 12 2018, 3:53 PM
This revision was automatically updated to reflect the committed changes.