[PATCH] D100738: Cache attribute checks
Nick Lewycky via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 19 16:01:23 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rGcf899a31aebf: Add a cache of checked AttributeLists. (authored by nickwasmer, committed by nicholas).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100738/new/
https://reviews.llvm.org/D100738
Files:
llvm/lib/IR/Verifier.cpp
Index: llvm/lib/IR/Verifier.cpp
===================================================================
--- llvm/lib/IR/Verifier.cpp
+++ llvm/lib/IR/Verifier.cpp
@@ -328,6 +328,9 @@
/// Cache of declarations of the llvm.experimental.deoptimize.<ty> intrinsic.
SmallVector<const Function *, 4> DeoptimizeDeclarations;
+ /// Cache of attribute lists verified.
+ SmallPtrSet<const void *, 32> AttributeListsVisited;
+
// Verify that this GlobalValue is only used in this module.
// This map is used to avoid visiting uses twice. We can arrive at a user
// twice, if they have multiple operands. In particular for very large
@@ -1890,14 +1893,16 @@
if (Attrs.isEmpty())
return;
- Assert(Attrs.hasParentContext(Context),
- "Attribute list does not match Module context!", &Attrs);
- for (const auto &AttrSet : Attrs) {
- Assert(!AttrSet.hasAttributes() || AttrSet.hasParentContext(Context),
- "Attribute set does not match Module context!", &AttrSet);
- for (const auto &A : AttrSet) {
- Assert(A.hasParentContext(Context),
- "Attribute does not match Module context!", &A);
+ if (AttributeListsVisited.insert(Attrs.getRawPointer()).second) {
+ Assert(Attrs.hasParentContext(Context),
+ "Attribute list does not match Module context!", &Attrs);
+ for (const auto &AttrSet : Attrs) {
+ Assert(!AttrSet.hasAttributes() || AttrSet.hasParentContext(Context),
+ "Attribute set does not match Module context!", &AttrSet);
+ for (const auto &A : AttrSet) {
+ Assert(A.hasParentContext(Context),
+ "Attribute does not match Module context!", &A);
+ }
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100738.338662.patch
Type: text/x-patch
Size: 1685 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210419/bc676c63/attachment.bin>
More information about the llvm-commits
mailing list