LLVM cmplog factoring custom Instruction iterator with added restriction

This commit is contained in:
David CARLIER
2023-02-13 23:00:15 +00:00
parent 6030df2f56
commit 8bc3fa1df2
4 changed files with 20 additions and 30 deletions

View File

@ -582,6 +582,24 @@ bool isInInstrumentList(llvm::Function *F, std::string Filename) {
}
template <class Iterator>
Iterator Unique(Iterator first, Iterator last) {
static_assert(std::is_trivially_copyable<
typename std::iterator_traits<Iterator>
>::value_type, "Invalid underlying type");
while (first != last) {
Iterator next(first);
last = std::remove(++next, last, *first);
first = next;
}
return last;
}
// Calculate the number of average collisions that would occur if all
// location IDs would be assigned randomly (like normal afl/afl++).
// This uses the "balls in bins" algorithm.