Skip to content

Commit b1a5901

Browse files
committed
llvm-reduce: Avoid double map lookup
Check if insert succeeded or not. This would change behavior if there are recursive MDNodes, but I'm not sure those are a thing.
1 parent 0ed8b27 commit b1a5901

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void identifyUninterestingMDNodes(Oracle &O, MDNodeList &MDs) {
3939
MDNode *MD = ToLook.back();
4040
ToLook.pop_back();
4141

42-
if (Visited.count(MD))
42+
if (!Visited.insert(MD))
4343
continue;
4444

4545
// Determine if the current MDNode is DebugInfo
@@ -55,8 +55,6 @@ void identifyUninterestingMDNodes(Oracle &O, MDNodeList &MDs) {
5555
for (Metadata *Op : MD->operands())
5656
if (MDNode *OMD = dyn_cast_or_null<MDNode>(Op))
5757
ToLook.push_back(OMD);
58-
59-
Visited.insert(MD);
6058
}
6159

6260
for (auto &T : Tuples) {

0 commit comments

Comments
 (0)