projects
/
platform
/
upstream
/
llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a7fa35a
)
[IR] Avoid linear scan in MDNode::intersect() (NFC)
author
Nikita Popov
<nikita.ppv@gmail.com>
Thu, 28 May 2020 15:15:21 +0000
(17:15 +0200)
committer
Nikita Popov
<nikita.ppv@gmail.com>
Thu, 28 May 2020 17:38:46 +0000
(19:38 +0200)
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.
llvm/lib/IR/Metadata.cpp
patch
|
blob
|
history
diff --git
a/llvm/lib/IR/Metadata.cpp
b/llvm/lib/IR/Metadata.cpp
index cdd544040f528eeb09f3be70e387acf6e11547cd..ce89009e86ebab386ade5d8b57acca05d63c42a0 100644
(file)
--- a/
llvm/lib/IR/Metadata.cpp
+++ b/
llvm/lib/IR/Metadata.cpp
@@
-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?