SIL serialization: add PrettyStackTraces (#13289)

...to help in debugging things like SR-6522.
diff --git a/lib/Serialization/DeserializeSIL.cpp b/lib/Serialization/DeserializeSIL.cpp
index 91e3d85..2e0dd2e 100644
--- a/lib/Serialization/DeserializeSIL.cpp
+++ b/lib/Serialization/DeserializeSIL.cpp
@@ -13,8 +13,10 @@
 #define DEBUG_TYPE "deserialize"
 #include "DeserializeSIL.h"
 #include "swift/Basic/Defer.h"
+#include "swift/Basic/PrettyStackTrace.h"
 #include "swift/AST/GenericSignature.h"
 #include "swift/AST/ProtocolConformance.h"
+#include "swift/AST/PrettyStackTrace.h"
 #include "swift/Serialization/ModuleFile.h"
 #include "SILFormat.h"
 #include "swift/SIL/SILArgument.h"
@@ -382,6 +384,8 @@
     return nullptr;
   assert(FID <= Funcs.size() && "invalid SILFunction ID");
 
+  PrettyStackTraceStringAction trace("deserializing SIL function", name);
+
   auto &cacheEntry = Funcs[FID-1];
   if (cacheEntry.isFullyDeserialized() ||
       (cacheEntry.isDeserialized() && declarationOnly))
@@ -2419,6 +2423,8 @@
   if (!GlobalVarList)
     return nullptr;
 
+  PrettyStackTraceStringAction trace("deserializing SIL global", Name);
+
   // If we already deserialized this global variable, just return it.
   if (auto *GV = SILMod.lookUpGlobalVariable(Name))
     return GV;
@@ -2543,6 +2549,9 @@
   }
 
   ClassDecl *theClass = cast<ClassDecl>(MF->getDecl(ClassID));
+
+  PrettyStackTraceDecl trace("deserializing SIL vtable for", theClass);
+
   // Fetch the next record.
   scratch.clear();
   entry = SILCursor.advance(AF_DontPopBlockAtEnd);
@@ -2662,6 +2671,11 @@
   auto theConformance = cast<NormalProtocolConformance>(
                           MF->readConformance(SILCursor).getConcrete());
 
+  PrettyStackTraceType trace(SILMod.getASTContext(),
+                             "deserializing SIL witness table for",
+                             theConformance->getType());
+  PrettyStackTraceDecl trace2("... to", theConformance->getProtocol());
+
   if (!existingWt)
     existingWt = SILMod.lookUpWitnessTable(theConformance, false);
   auto wT = existingWt;
@@ -2856,6 +2870,8 @@
     return nullptr;
   }
 
+  PrettyStackTraceDecl trace("deserializing default witness table for", proto);
+
   if (!existingWt)
     existingWt = SILMod.lookUpDefaultWitnessTable(proto, /*deserializeLazily=*/ false);
   auto wT = existingWt;