troyj created this revision.
troyj added a reviewer: bruno.
Herald added a project: All.
troyj requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch changes the Profile function to match the FunctionProtoType 
constructor, which uses epi.ExceptionSpec.SourceDecl and not 
epi.ExceptionSpec.SourceDecl->getCanonicalDecl(). This change eliminates an 
inconsistency that was observed within the FunctionProtoTypes set by adding a 
verification function to FoldingSet to assert that all items in the set still 
hash to their current bucket. Asserting this verification showed that some 
FunctionProtoTypes no longer hashed to their original bucket. This 
inconsistency was not catastrophic because of self-correction -- FoldingSet 
does not store hashes and recomputes them whenever it rebuckets. Thus, it's not 
possible to observe the issue immediately after rebucketing. Comparing the 
before and after profiles of a FunctionProtoType that was in the wrong bucket 
showed that the only part of the profile that changed was 
epi.ExceptionSpec.SourceDecl->getCanonicalDecl(). After changing the profile 
function to match the constructor, no incorrectly bucketed FunctionProtoTypes 
were observed in a TU with ~2.6M prototypes.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136779

Files:
  clang/lib/AST/Type.cpp


Index: clang/lib/AST/Type.cpp
===================================================================
--- clang/lib/AST/Type.cpp
+++ clang/lib/AST/Type.cpp
@@ -3385,7 +3385,7 @@
     epi.ExceptionSpec.NoexceptExpr->Profile(ID, Context, Canonical);
   } else if (epi.ExceptionSpec.Type == EST_Uninstantiated ||
              epi.ExceptionSpec.Type == EST_Unevaluated) {
-    ID.AddPointer(epi.ExceptionSpec.SourceDecl->getCanonicalDecl());
+    ID.AddPointer(epi.ExceptionSpec.SourceDecl);
   }
   if (epi.ExtParameterInfos) {
     for (unsigned i = 0; i != NumParams; ++i)


Index: clang/lib/AST/Type.cpp
===================================================================
--- clang/lib/AST/Type.cpp
+++ clang/lib/AST/Type.cpp
@@ -3385,7 +3385,7 @@
     epi.ExceptionSpec.NoexceptExpr->Profile(ID, Context, Canonical);
   } else if (epi.ExceptionSpec.Type == EST_Uninstantiated ||
              epi.ExceptionSpec.Type == EST_Unevaluated) {
-    ID.AddPointer(epi.ExceptionSpec.SourceDecl->getCanonicalDecl());
+    ID.AddPointer(epi.ExceptionSpec.SourceDecl);
   }
   if (epi.ExtParameterInfos) {
     for (unsigned i = 0; i != NumParams; ++i)
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to