[PATCH] D99444: [ADT] Introduce lazy unique iterator
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 26 14:23:13 PDT 2021
lebedev.ri created this revision.
lebedev.ri added reviewers: bkramer, dexonsmith, dblaikie, rriddle.
lebedev.ri added a project: LLVM.
Herald added a subscriber: hiraditya.
lebedev.ri requested review of this revision.
You sometimes want to only deal with unique values of an underlying range.
Manually maintaining a set of already-dealt-with elements is cumbersome.
This introduces a `unique_iterator` forward iterator,
which lazily(!) tracks the elements of the range that were pointed-at already,
and skips them afterwards.
I've added some basic tests and adjusted a few places to use it.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D99444
Files:
llvm/include/llvm/ADT/UniqueRange.h
llvm/lib/Analysis/ValueTracking.cpp
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
llvm/unittests/ADT/IteratorTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99444.333629.patch
Type: text/x-patch
Size: 8657 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210326/02f5969e/attachment.bin>
More information about the llvm-commits
mailing list