1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00

[IR] Avoid linear scan in MDNode::intersect() (NFC)

00940fb8544767ba5217922c4ba96677aabe9eb3 changed this code to
construct a set for the B metadata. However, it still performs a
linear is_contained query, rather than making use of the set
structure.
This commit is contained in:
Nikita Popov 2020-05-28 17:15:21 +02:00
parent 9896d761e8
commit 2298d7abda

View File

@ -914,7 +914,7 @@ MDNode *MDNode::intersect(MDNode *A, MDNode *B) {
SmallSetVector<Metadata *, 4> MDs(A->op_begin(), A->op_end());
SmallPtrSet<Metadata *, 4> BSet(B->op_begin(), B->op_end());
MDs.remove_if([&](Metadata *MD) { return !is_contained(BSet, MD); });
MDs.remove_if([&](Metadata *MD) { return !BSet.count(MD); });
// FIXME: This preserves long-standing behaviour, but is it really the right
// behaviour? Or was that an unintended side-effect of node uniquing?