This is an archive of the discontinued LLVM Phabricator instance.

Fix PR32157 - Hoist fp division from the loops and replace by a reciprocal
ClosedPublic

Authored by vit9696 on Mar 10 2017, 5:10 AM.

Details

Summary

This change may double the performance of certain functions relying on floating point division in the loops. Certain examples and discussion are listed in the mentioned bugreport.

Diff Detail

Repository
rL LLVM

Event Timeline

vit9696 created this revision.Mar 10 2017, 5:10 AM
hfinkel edited edge metadata.Mar 24 2017, 10:16 AM

A comment on the variable names; otherwise I think this looks good. Thanks!

lib/Transforms/Scalar/LICM.cpp
445 ↗(On Diff #91314)

I find naming this Reciproal to be a bit confusing (because I'd expect a 1/something to be named Reciprocal). You might even name InvDivisor ReciprocalDivisor (or just RecipDivisor). The result of the multiplication could be named Product or Division or something along those lines.

vit9696 updated this revision to Diff 93033.Mar 25 2017, 12:08 AM

A comment on the variable names; otherwise I think this looks good. Thanks!

Thanks. This makes good sense to me. Updated the diff.

hfinkel accepted this revision.Mar 25 2017, 7:00 AM

Formatting nit, otherwise LGTM.

lib/Transforms/Scalar/LICM.cpp
445 ↗(On Diff #93033)

This line is too long (max is 80 characters).

This revision is now accepted and ready to land.Mar 25 2017, 7:00 AM
vit9696 updated this revision to Diff 93049.Mar 25 2017, 10:35 AM

Alright, fixed the line width as well.

This revision was automatically updated to reflect the committed changes.