Page MenuHomePhabricator

[SelectionDAG][RFC] Allow the user to specify a memeq function (v5).
Needs ReviewPublic

Authored by courbet on Fri, Jan 11, 4:45 AM.
This revision needs review, but there are no reviewers specified.

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 replaces memcmp(a, b, s) == 0 by bcmp(a, b, s) == 0 on platforms
that support bcmp.

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

Diff Detail