[PATCH] D125979: [ADT] add LockFreeDataPool class.
David Blaikie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 23 15:47:36 PDT 2022
dblaikie added a comment.
In D125979#3532163 <https://reviews.llvm.org/D125979#3532163>, @avl wrote:
> In D125979#3529745 <https://reviews.llvm.org/D125979#3529745>, @dblaikie wrote:
>
>> (any chance we can avoid duplicating this, and instead refactor the lld one into LLVM and have lld use that one instead of using its own local copy?)
>
> I thought about that. But the implementation from lld looks too specific for general implementation.
> It uses knowledge about stored data:
>
> 1. It keeps data together with hash inside hash table. This is OK for 32-bit integer but it would not be OK for larger type.
Other LLVM data structures make different choices based on the size of the content (eg: the default size of SmallVector varies depending on the size of the elements) - using traits or other template techniques seems suitable.
> 2. It compares data to select which version should be stored. We need a way to do it or avoid it without introducing more checks.
>
>
>
> if (!oldCell.isEmpty() >>>&& oldCell < newCell<<<)
> return idx;
Yeah, some sort of trait could be used to implement that (but maybe there are other broader abstractions) - like maybe that functionality should stay out in lld, even if the data structure's moved into LLVM - lld could "insert, check that the thing was already present, then do the comparison/decide whether to overwrite" - doesn't sound like it'd be a performance issue.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125979/new/
https://reviews.llvm.org/D125979
More information about the llvm-commits
mailing list