[PATCH] D40697: Cache modulo values for the .gnu.hash section.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 1 17:00:13 PST 2017


Joerg Sonnenberger via Phabricator <reviews at reviews.llvm.org> writes:

> joerg added a comment.
>
> Instead of computing and storing the modulus directly, it is likely better to precompute the inverse and use that to improve the performance of the operation in first place. Consider using fast_remainder32 <https://bitbucket.org/netbsd/src/src/186da2a4e05b898f94827ca5f9d77b3cd5902a6f/sys/sys/bitops.h?at=trunk&fileviewer=file-view-default#bitops.h-264>  and associated functions.

Rui's patch reduces the number of times we compute % NBuckets. Your idea
makes that computation faster, so it seems complementary.

Rui's patch is fairly simple, I think it is reasonable to commit that
first and then try to optimize the % computation if that is still
expensive.

Cheers,
Rafael


More information about the llvm-commits mailing list