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