This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG][RFC] Allow the user to specify a memeq function.
AbandonedPublic

Authored by courbet on Jan 3 2019, 1:07 AM.

Details

Reviewers
None
Summary

Right now, when we encounter a string equality check,
e.g. if (memcmp(a, b, s) == 0), we try to expand to a comparison if s is a
small compile-time constant, and fall back on calling memcmp() else.

This is sub-optimal because memcmp has to compute much more than
equality.

This patch adds a way for the user to specify a memeq library
function (e.g. -memeq-lib-function=user_memeq) which will be called
instead of memcmp() when the result of the memcmp call is only used
for equality comparison.

memeq can be made much more efficient than memcmp because equality
compare is trivially parallel while lexicographic ordering has a chain
dependency.

Diff Detail

Event Timeline

courbet created this revision.Jan 3 2019, 1:07 AM
courbet updated this revision to Diff 180006.Jan 3 2019, 1:09 AM

remove useless decl

How is this supposed to be exposed to the middle-end, front-end?
Might be better off as a RFC..

How is this supposed to be exposed to the middle-end, front-end?
Might be better off as a RFC..

RFC is coming, I'ts always better to have an actual patch to show.

courbet abandoned this revision.Mar 12 2019, 12:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 12 2019, 12:26 AM
Herald added a subscriber: jdoerfert. · View Herald Transcript