CheckChunk(Chunk &ChunkToCheckForUninterestingness,
std::unique_ptr<ReducerWorkItem> Clone, TestRunner &Test,
ReductionFunc ExtractChunksFromModule,
- std::set<Chunk> &UninterestingChunks,
+ DenseSet<Chunk> &UninterestingChunks,
std::vector<Chunk> &ChunksStillConsideredInteresting) {
// Take all of ChunksStillConsideredInteresting chunks, except those we've
// already deemed uninteresting (UninterestingChunks) but didn't remove
static SmallString<0> ProcessChunkFromSerializedBitcode(
Chunk &ChunkToCheckForUninterestingness, TestRunner &Test,
- ReductionFunc ExtractChunksFromModule, std::set<Chunk> &UninterestingChunks,
+ ReductionFunc ExtractChunksFromModule, DenseSet<Chunk> &UninterestingChunks,
std::vector<Chunk> &ChunksStillConsideredInteresting,
SmallString<0> &OriginalBC, std::atomic<bool> &AnyReduced) {
LLVMContext Ctx;
do {
FoundAtLeastOneNewUninterestingChunkWithCurrentGranularity = false;
- std::set<Chunk> UninterestingChunks;
+ DenseSet<Chunk> UninterestingChunks;
// When running with more than one thread, serialize the original bitcode
// to OriginalBC.
return C1.Begin != C2.Begin || C1.End != C2.End;
}
+ friend bool operator==(const Chunk &C1, const Chunk &C2) {
+ return C1.Begin == C2.Begin && C1.End == C2.End;
+ }
+
/// Operator used for sets
friend bool operator<(const Chunk &C1, const Chunk &C2) {
return std::tie(C1.Begin, C1.End) < std::tie(C2.Begin, C2.End);
}
};
+template<>
+struct DenseMapInfo<Chunk> {
+ static inline Chunk getEmptyKey() {
+ return {DenseMapInfo<int>::getEmptyKey(),
+ DenseMapInfo<int>::getEmptyKey()};
+ }
+
+ static inline Chunk getTombstoneKey() {
+ return {DenseMapInfo<int>::getTombstoneKey(),
+ DenseMapInfo<int>::getTombstoneKey()};
+ }
+
+ static unsigned getHashValue(const Chunk Val) {
+ std::pair<int, int> PairVal = std::make_pair(Val.Begin, Val.End);
+ return DenseMapInfo<std::pair<int, int>>::getHashValue(PairVal);
+ }
+
+ static bool isEqual(const Chunk LHS, const Chunk RHS) {
+ return LHS == RHS;
+ }
+};
+
+
/// Provides opaque interface for querying into ChunksToKeep without having to
/// actually understand what is going on.
class Oracle {