1 //===- ThinLTOBitcodeWriter.cpp - Bitcode writing pass for ThinLTO --------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "llvm/Transforms/IPO/ThinLTOBitcodeWriter.h"
10 #include "llvm/Analysis/BasicAliasAnalysis.h"
11 #include "llvm/Analysis/ModuleSummaryAnalysis.h"
12 #include "llvm/Analysis/ProfileSummaryInfo.h"
13 #include "llvm/Analysis/TypeMetadataUtils.h"
14 #include "llvm/Bitcode/BitcodeWriter.h"
15 #include "llvm/IR/Constants.h"
16 #include "llvm/IR/DebugInfo.h"
17 #include "llvm/IR/Intrinsics.h"
18 #include "llvm/IR/Module.h"
19 #include "llvm/IR/PassManager.h"
20 #include "llvm/Object/ModuleSymbolTable.h"
21 #include "llvm/Pass.h"
22 #include "llvm/Support/ScopedPrinter.h"
23 #include "llvm/Support/raw_ostream.h"
24 #include "llvm/Transforms/IPO.h"
25 #include "llvm/Transforms/IPO/FunctionAttrs.h"
26 #include "llvm/Transforms/IPO/FunctionImport.h"
27 #include "llvm/Transforms/Utils/Cloning.h"
28 #include "llvm/Transforms/Utils/ModuleUtils.h"
29 using namespace llvm;
30 
31 namespace {
32 
33 // Promote each local-linkage entity defined by ExportM and used by ImportM by
34 // changing visibility and appending the given ModuleId.
35 void promoteInternals(Module &ExportM, Module &ImportM, StringRef ModuleId,
36                       SetVector<GlobalValue *> &PromoteExtra) {
37   DenseMap<const Comdat *, Comdat *> RenamedComdats;
38   for (auto &ExportGV : ExportM.global_values()) {
39     if (!ExportGV.hasLocalLinkage())
40       continue;
41 
42     auto Name = ExportGV.getName();
43     GlobalValue *ImportGV = nullptr;
44     if (!PromoteExtra.count(&ExportGV)) {
45       ImportGV = ImportM.getNamedValue(Name);
46       if (!ImportGV)
47         continue;
48       ImportGV->removeDeadConstantUsers();
49       if (ImportGV->use_empty()) {
50         ImportGV->eraseFromParent();
51         continue;
52       }
53     }
54 
55     std::string NewName = (Name + ModuleId).str();
56 
57     if (const auto *C = ExportGV.getComdat())
58       if (C->getName() == Name)
59         RenamedComdats.try_emplace(C, ExportM.getOrInsertComdat(NewName));
60 
61     ExportGV.setName(NewName);
62     ExportGV.setLinkage(GlobalValue::ExternalLinkage);
63     ExportGV.setVisibility(GlobalValue::HiddenVisibility);
64 
65     if (ImportGV) {
66       ImportGV->setName(NewName);
67       ImportGV->setVisibility(GlobalValue::HiddenVisibility);
68     }
69   }
70 
71   if (!RenamedComdats.empty())
72     for (auto &GO : ExportM.global_objects())
73       if (auto *C = GO.getComdat()) {
74         auto Replacement = RenamedComdats.find(C);
75         if (Replacement != RenamedComdats.end())
76           GO.setComdat(Replacement->second);
77       }
78 }
79 
80 // Promote all internal (i.e. distinct) type ids used by the module by replacing
81 // them with external type ids formed using the module id.
82 //
83 // Note that this needs to be done before we clone the module because each clone
84 // will receive its own set of distinct metadata nodes.
85 void promoteTypeIds(Module &M, StringRef ModuleId) {
86   DenseMap<Metadata *, Metadata *> LocalToGlobal;
87   auto ExternalizeTypeId = [&](CallInst *CI, unsigned ArgNo) {
88     Metadata *MD =
89         cast<MetadataAsValue>(CI->getArgOperand(ArgNo))->getMetadata();
90 
91     if (isa<MDNode>(MD) && cast<MDNode>(MD)->isDistinct()) {
92       Metadata *&GlobalMD = LocalToGlobal[MD];
93       if (!GlobalMD) {
94         std::string NewName = (Twine(LocalToGlobal.size()) + ModuleId).str();
95         GlobalMD = MDString::get(M.getContext(), NewName);
96       }
97 
98       CI->setArgOperand(ArgNo,
99                         MetadataAsValue::get(M.getContext(), GlobalMD));
100     }
101   };
102 
103   if (Function *TypeTestFunc =
104           M.getFunction(Intrinsic::getName(Intrinsic::type_test))) {
105     for (const Use &U : TypeTestFunc->uses()) {
106       auto CI = cast<CallInst>(U.getUser());
107       ExternalizeTypeId(CI, 1);
108     }
109   }
110 
111   if (Function *TypeCheckedLoadFunc =
112           M.getFunction(Intrinsic::getName(Intrinsic::type_checked_load))) {
113     for (const Use &U : TypeCheckedLoadFunc->uses()) {
114       auto CI = cast<CallInst>(U.getUser());
115       ExternalizeTypeId(CI, 2);
116     }
117   }
118 
119   for (GlobalObject &GO : M.global_objects()) {
120     SmallVector<MDNode *, 1> MDs;
121     GO.getMetadata(LLVMContext::MD_type, MDs);
122 
123     GO.eraseMetadata(LLVMContext::MD_type);
124     for (auto MD : MDs) {
125       auto I = LocalToGlobal.find(MD->getOperand(1));
126       if (I == LocalToGlobal.end()) {
127         GO.addMetadata(LLVMContext::MD_type, *MD);
128         continue;
129       }
130       GO.addMetadata(
131           LLVMContext::MD_type,
132           *MDNode::get(M.getContext(), {MD->getOperand(0), I->second}));
133     }
134   }
135 }
136 
137 // Drop unused globals, and drop type information from function declarations.
138 // FIXME: If we made functions typeless then there would be no need to do this.
139 void simplifyExternals(Module &M) {
140   FunctionType *EmptyFT =
141       FunctionType::get(Type::getVoidTy(M.getContext()), false);
142 
143   for (auto I = M.begin(), E = M.end(); I != E;) {
144     Function &F = *I++;
145     if (F.isDeclaration() && F.use_empty()) {
146       F.eraseFromParent();
147       continue;
148     }
149 
150     if (!F.isDeclaration() || F.getFunctionType() == EmptyFT ||
151         // Changing the type of an intrinsic may invalidate the IR.
152         F.getName().startswith("llvm."))
153       continue;
154 
155     Function *NewF =
156         Function::Create(EmptyFT, GlobalValue::ExternalLinkage,
157                          F.getAddressSpace(), "", &M);
158     NewF->setVisibility(F.getVisibility());
159     NewF->takeName(&F);
160     F.replaceAllUsesWith(ConstantExpr::getBitCast(NewF, F.getType()));
161     F.eraseFromParent();
162   }
163 
164   for (auto I = M.global_begin(), E = M.global_end(); I != E;) {
165     GlobalVariable &GV = *I++;
166     if (GV.isDeclaration() && GV.use_empty()) {
167       GV.eraseFromParent();
168       continue;
169     }
170   }
171 }
172 
173 static void
174 filterModule(Module *M,
175              function_ref<bool(const GlobalValue *)> ShouldKeepDefinition) {
176   std::vector<GlobalValue *> V;
177   for (GlobalValue &GV : M->global_values())
178     if (!ShouldKeepDefinition(&GV))
179       V.push_back(&GV);
180 
181   for (GlobalValue *GV : V)
182     if (!convertToDeclaration(*GV))
183       GV->eraseFromParent();
184 }
185 
186 void forEachVirtualFunction(Constant *C, function_ref<void(Function *)> Fn) {
187   if (auto *F = dyn_cast<Function>(C))
188     return Fn(F);
189   if (isa<GlobalValue>(C))
190     return;
191   for (Value *Op : C->operands())
192     forEachVirtualFunction(cast<Constant>(Op), Fn);
193 }
194 
195 // If it's possible to split M into regular and thin LTO parts, do so and write
196 // a multi-module bitcode file with the two parts to OS. Otherwise, write only a
197 // regular LTO bitcode file to OS.
198 void splitAndWriteThinLTOBitcode(
199     raw_ostream &OS, raw_ostream *ThinLinkOS,
200     function_ref<AAResults &(Function &)> AARGetter, Module &M) {
201   std::string ModuleId = getUniqueModuleId(&M);
202   if (ModuleId.empty()) {
203     // We couldn't generate a module ID for this module, write it out as a
204     // regular LTO module with an index for summary-based dead stripping.
205     ProfileSummaryInfo PSI(M);
206     M.addModuleFlag(Module::Error, "ThinLTO", uint32_t(0));
207     ModuleSummaryIndex Index = buildModuleSummaryIndex(M, nullptr, &PSI);
208     WriteBitcodeToFile(M, OS, /*ShouldPreserveUseListOrder=*/false, &Index);
209 
210     if (ThinLinkOS)
211       // We don't have a ThinLTO part, but still write the module to the
212       // ThinLinkOS if requested so that the expected output file is produced.
213       WriteBitcodeToFile(M, *ThinLinkOS, /*ShouldPreserveUseListOrder=*/false,
214                          &Index);
215 
216     return;
217   }
218 
219   promoteTypeIds(M, ModuleId);
220 
221   // Returns whether a global or its associated global has attached type
222   // metadata. The former may participate in CFI or whole-program
223   // devirtualization, so they need to appear in the merged module instead of
224   // the thin LTO module. Similarly, globals that are associated with globals
225   // with type metadata need to appear in the merged module because they will
226   // reference the global's section directly.
227   auto HasTypeMetadata = [](const GlobalObject *GO) {
228     if (MDNode *MD = GO->getMetadata(LLVMContext::MD_associated))
229       if (auto *AssocVM = dyn_cast_or_null<ValueAsMetadata>(MD->getOperand(0)))
230         if (auto *AssocGO = dyn_cast<GlobalObject>(AssocVM->getValue()))
231           if (AssocGO->hasMetadata(LLVMContext::MD_type))
232             return true;
233     return GO->hasMetadata(LLVMContext::MD_type);
234   };
235 
236   // Collect the set of virtual functions that are eligible for virtual constant
237   // propagation. Each eligible function must not access memory, must return
238   // an integer of width <=64 bits, must take at least one argument, must not
239   // use its first argument (assumed to be "this") and all arguments other than
240   // the first one must be of <=64 bit integer type.
241   //
242   // Note that we test whether this copy of the function is readnone, rather
243   // than testing function attributes, which must hold for any copy of the
244   // function, even a less optimized version substituted at link time. This is
245   // sound because the virtual constant propagation optimizations effectively
246   // inline all implementations of the virtual function into each call site,
247   // rather than using function attributes to perform local optimization.
248   DenseSet<const Function *> EligibleVirtualFns;
249   // If any member of a comdat lives in MergedM, put all members of that
250   // comdat in MergedM to keep the comdat together.
251   DenseSet<const Comdat *> MergedMComdats;
252   for (GlobalVariable &GV : M.globals())
253     if (HasTypeMetadata(&GV)) {
254       if (const auto *C = GV.getComdat())
255         MergedMComdats.insert(C);
256       forEachVirtualFunction(GV.getInitializer(), [&](Function *F) {
257         auto *RT = dyn_cast<IntegerType>(F->getReturnType());
258         if (!RT || RT->getBitWidth() > 64 || F->arg_empty() ||
259             !F->arg_begin()->use_empty())
260           return;
261         for (auto &Arg : make_range(std::next(F->arg_begin()), F->arg_end())) {
262           auto *ArgT = dyn_cast<IntegerType>(Arg.getType());
263           if (!ArgT || ArgT->getBitWidth() > 64)
264             return;
265         }
266         if (!F->isDeclaration() &&
267             computeFunctionBodyMemoryAccess(*F, AARGetter(*F)) == MAK_ReadNone)
268           EligibleVirtualFns.insert(F);
269       });
270     }
271 
272   ValueToValueMapTy VMap;
273   std::unique_ptr<Module> MergedM(
274       CloneModule(M, VMap, [&](const GlobalValue *GV) -> bool {
275         if (const auto *C = GV->getComdat())
276           if (MergedMComdats.count(C))
277             return true;
278         if (auto *F = dyn_cast<Function>(GV))
279           return EligibleVirtualFns.count(F);
280         if (auto *GVar = dyn_cast_or_null<GlobalVariable>(GV->getBaseObject()))
281           return HasTypeMetadata(GVar);
282         return false;
283       }));
284   StripDebugInfo(*MergedM);
285   MergedM->setModuleInlineAsm("");
286 
287   for (Function &F : *MergedM)
288     if (!F.isDeclaration()) {
289       // Reset the linkage of all functions eligible for virtual constant
290       // propagation. The canonical definitions live in the thin LTO module so
291       // that they can be imported.
292       F.setLinkage(GlobalValue::AvailableExternallyLinkage);
293       F.setComdat(nullptr);
294     }
295 
296   SetVector<GlobalValue *> CfiFunctions;
297   for (auto &F : M)
298     if ((!F.hasLocalLinkage() || F.hasAddressTaken()) && HasTypeMetadata(&F))
299       CfiFunctions.insert(&F);
300 
301   // Remove all globals with type metadata, globals with comdats that live in
302   // MergedM, and aliases pointing to such globals from the thin LTO module.
303   filterModule(&M, [&](const GlobalValue *GV) {
304     if (auto *GVar = dyn_cast_or_null<GlobalVariable>(GV->getBaseObject()))
305       if (HasTypeMetadata(GVar))
306         return false;
307     if (const auto *C = GV->getComdat())
308       if (MergedMComdats.count(C))
309         return false;
310     return true;
311   });
312 
313   promoteInternals(*MergedM, M, ModuleId, CfiFunctions);
314   promoteInternals(M, *MergedM, ModuleId, CfiFunctions);
315 
316   auto &Ctx = MergedM->getContext();
317   SmallVector<MDNode *, 8> CfiFunctionMDs;
318   for (auto V : CfiFunctions) {
319     Function &F = *cast<Function>(V);
320     SmallVector<MDNode *, 2> Types;
321     F.getMetadata(LLVMContext::MD_type, Types);
322 
323     SmallVector<Metadata *, 4> Elts;
324     Elts.push_back(MDString::get(Ctx, F.getName()));
325     CfiFunctionLinkage Linkage;
326     if (!F.isDeclarationForLinker())
327       Linkage = CFL_Definition;
328     else if (F.isWeakForLinker())
329       Linkage = CFL_WeakDeclaration;
330     else
331       Linkage = CFL_Declaration;
332     Elts.push_back(ConstantAsMetadata::get(
333         llvm::ConstantInt::get(Type::getInt8Ty(Ctx), Linkage)));
334     for (auto Type : Types)
335       Elts.push_back(Type);
336     CfiFunctionMDs.push_back(MDTuple::get(Ctx, Elts));
337   }
338 
339   if(!CfiFunctionMDs.empty()) {
340     NamedMDNode *NMD = MergedM->getOrInsertNamedMetadata("cfi.functions");
341     for (auto MD : CfiFunctionMDs)
342       NMD->addOperand(MD);
343   }
344 
345   SmallVector<MDNode *, 8> FunctionAliases;
346   for (auto &A : M.aliases()) {
347     if (!isa<Function>(A.getAliasee()))
348       continue;
349 
350     auto *F = cast<Function>(A.getAliasee());
351 
352     Metadata *Elts[] = {
353         MDString::get(Ctx, A.getName()),
354         MDString::get(Ctx, F->getName()),
355         ConstantAsMetadata::get(
356             ConstantInt::get(Type::getInt8Ty(Ctx), A.getVisibility())),
357         ConstantAsMetadata::get(
358             ConstantInt::get(Type::getInt8Ty(Ctx), A.isWeakForLinker())),
359     };
360 
361     FunctionAliases.push_back(MDTuple::get(Ctx, Elts));
362   }
363 
364   if (!FunctionAliases.empty()) {
365     NamedMDNode *NMD = MergedM->getOrInsertNamedMetadata("aliases");
366     for (auto MD : FunctionAliases)
367       NMD->addOperand(MD);
368   }
369 
370   SmallVector<MDNode *, 8> Symvers;
371   ModuleSymbolTable::CollectAsmSymvers(M, [&](StringRef Name, StringRef Alias) {
372     Function *F = M.getFunction(Name);
373     if (!F || F->use_empty())
374       return;
375 
376     Symvers.push_back(MDTuple::get(
377         Ctx, {MDString::get(Ctx, Name), MDString::get(Ctx, Alias)}));
378   });
379 
380   if (!Symvers.empty()) {
381     NamedMDNode *NMD = MergedM->getOrInsertNamedMetadata("symvers");
382     for (auto MD : Symvers)
383       NMD->addOperand(MD);
384   }
385 
386   simplifyExternals(*MergedM);
387 
388   // FIXME: Try to re-use BSI and PFI from the original module here.
389   ProfileSummaryInfo PSI(M);
390   ModuleSummaryIndex Index = buildModuleSummaryIndex(M, nullptr, &PSI);
391 
392   // Mark the merged module as requiring full LTO. We still want an index for
393   // it though, so that it can participate in summary-based dead stripping.
394   MergedM->addModuleFlag(Module::Error, "ThinLTO", uint32_t(0));
395   ModuleSummaryIndex MergedMIndex =
396       buildModuleSummaryIndex(*MergedM, nullptr, &PSI);
397 
398   SmallVector<char, 0> Buffer;
399 
400   BitcodeWriter W(Buffer);
401   // Save the module hash produced for the full bitcode, which will
402   // be used in the backends, and use that in the minimized bitcode
403   // produced for the full link.
404   ModuleHash ModHash = {{0}};
405   W.writeModule(M, /*ShouldPreserveUseListOrder=*/false, &Index,
406                 /*GenerateHash=*/true, &ModHash);
407   W.writeModule(*MergedM, /*ShouldPreserveUseListOrder=*/false, &MergedMIndex);
408   W.writeSymtab();
409   W.writeStrtab();
410   OS << Buffer;
411 
412   // If a minimized bitcode module was requested for the thin link, only
413   // the information that is needed by thin link will be written in the
414   // given OS (the merged module will be written as usual).
415   if (ThinLinkOS) {
416     Buffer.clear();
417     BitcodeWriter W2(Buffer);
418     StripDebugInfo(M);
419     W2.writeThinLinkBitcode(M, Index, ModHash);
420     W2.writeModule(*MergedM, /*ShouldPreserveUseListOrder=*/false,
421                    &MergedMIndex);
422     W2.writeSymtab();
423     W2.writeStrtab();
424     *ThinLinkOS << Buffer;
425   }
426 }
427 
428 // Check if the LTO Unit splitting has been enabled.
429 bool enableSplitLTOUnit(Module &M) {
430   bool EnableSplitLTOUnit = false;
431   if (auto *MD = mdconst::extract_or_null<ConstantInt>(
432           M.getModuleFlag("EnableSplitLTOUnit")))
433     EnableSplitLTOUnit = MD->getZExtValue();
434   return EnableSplitLTOUnit;
435 }
436 
437 // Returns whether this module needs to be split because it uses type metadata.
438 bool hasTypeMetadata(Module &M) {
439   for (auto &GO : M.global_objects()) {
440     if (GO.hasMetadata(LLVMContext::MD_type))
441       return true;
442   }
443   return false;
444 }
445 
446 void writeThinLTOBitcode(raw_ostream &OS, raw_ostream *ThinLinkOS,
447                          function_ref<AAResults &(Function &)> AARGetter,
448                          Module &M, const ModuleSummaryIndex *Index) {
449   std::unique_ptr<ModuleSummaryIndex> NewIndex = nullptr;
450   // See if this module has any type metadata. If so, we try to split it
451   // or at least promote type ids to enable WPD.
452   if (hasTypeMetadata(M)) {
453     if (enableSplitLTOUnit(M))
454       return splitAndWriteThinLTOBitcode(OS, ThinLinkOS, AARGetter, M);
455     // Promote type ids as needed for index-based WPD.
456     std::string ModuleId = getUniqueModuleId(&M);
457     if (!ModuleId.empty()) {
458       promoteTypeIds(M, ModuleId);
459       // Need to rebuild the index so that it contains type metadata
460       // for the newly promoted type ids.
461       // FIXME: Probably should not bother building the index at all
462       // in the caller of writeThinLTOBitcode (which does so via the
463       // ModuleSummaryIndexAnalysis pass), since we have to rebuild it
464       // anyway whenever there is type metadata (here or in
465       // splitAndWriteThinLTOBitcode). Just always build it once via the
466       // buildModuleSummaryIndex when Module(s) are ready.
467       ProfileSummaryInfo PSI(M);
468       NewIndex = llvm::make_unique<ModuleSummaryIndex>(
469           buildModuleSummaryIndex(M, nullptr, &PSI));
470       Index = NewIndex.get();
471     }
472   }
473 
474   // Write it out as an unsplit ThinLTO module.
475 
476   // Save the module hash produced for the full bitcode, which will
477   // be used in the backends, and use that in the minimized bitcode
478   // produced for the full link.
479   ModuleHash ModHash = {{0}};
480   WriteBitcodeToFile(M, OS, /*ShouldPreserveUseListOrder=*/false, Index,
481                      /*GenerateHash=*/true, &ModHash);
482   // If a minimized bitcode module was requested for the thin link, only
483   // the information that is needed by thin link will be written in the
484   // given OS.
485   if (ThinLinkOS && Index)
486     WriteThinLinkBitcodeToFile(M, *ThinLinkOS, *Index, ModHash);
487 }
488 
489 class WriteThinLTOBitcode : public ModulePass {
490   raw_ostream &OS; // raw_ostream to print on
491   // The output stream on which to emit a minimized module for use
492   // just in the thin link, if requested.
493   raw_ostream *ThinLinkOS;
494 
495 public:
496   static char ID; // Pass identification, replacement for typeid
497   WriteThinLTOBitcode() : ModulePass(ID), OS(dbgs()), ThinLinkOS(nullptr) {
498     initializeWriteThinLTOBitcodePass(*PassRegistry::getPassRegistry());
499   }
500 
501   explicit WriteThinLTOBitcode(raw_ostream &o, raw_ostream *ThinLinkOS)
502       : ModulePass(ID), OS(o), ThinLinkOS(ThinLinkOS) {
503     initializeWriteThinLTOBitcodePass(*PassRegistry::getPassRegistry());
504   }
505 
506   StringRef getPassName() const override { return "ThinLTO Bitcode Writer"; }
507 
508   bool runOnModule(Module &M) override {
509     const ModuleSummaryIndex *Index =
510         &(getAnalysis<ModuleSummaryIndexWrapperPass>().getIndex());
511     writeThinLTOBitcode(OS, ThinLinkOS, LegacyAARGetter(*this), M, Index);
512     return true;
513   }
514   void getAnalysisUsage(AnalysisUsage &AU) const override {
515     AU.setPreservesAll();
516     AU.addRequired<AssumptionCacheTracker>();
517     AU.addRequired<ModuleSummaryIndexWrapperPass>();
518     AU.addRequired<TargetLibraryInfoWrapperPass>();
519   }
520 };
521 } // anonymous namespace
522 
523 char WriteThinLTOBitcode::ID = 0;
524 INITIALIZE_PASS_BEGIN(WriteThinLTOBitcode, "write-thinlto-bitcode",
525                       "Write ThinLTO Bitcode", false, true)
526 INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
527 INITIALIZE_PASS_DEPENDENCY(ModuleSummaryIndexWrapperPass)
528 INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
529 INITIALIZE_PASS_END(WriteThinLTOBitcode, "write-thinlto-bitcode",
530                     "Write ThinLTO Bitcode", false, true)
531 
532 ModulePass *llvm::createWriteThinLTOBitcodePass(raw_ostream &Str,
533                                                 raw_ostream *ThinLinkOS) {
534   return new WriteThinLTOBitcode(Str, ThinLinkOS);
535 }
536 
537 PreservedAnalyses
538 llvm::ThinLTOBitcodeWriterPass::run(Module &M, ModuleAnalysisManager &AM) {
539   FunctionAnalysisManager &FAM =
540       AM.getResult<FunctionAnalysisManagerModuleProxy>(M).getManager();
541   writeThinLTOBitcode(OS, ThinLinkOS,
542                       [&FAM](Function &F) -> AAResults & {
543                         return FAM.getResult<AAManager>(F);
544                       },
545                       M, &AM.getResult<ModuleSummaryIndexAnalysis>(M));
546   return PreservedAnalyses::all();
547 }
548