diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2024-01-24 19:17:23 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2024-04-19 21:24:44 +0000 |
| commit | ab50317e96e57dee5b3ff4ad3f16f205b2a3359e (patch) | |
| tree | 4b1f388eb6a07e574417aaacecd3ec4a83550718 /contrib/llvm-project/llvm/lib/Bitcode/Writer | |
| parent | 412542983a5ba62902141a8a7e155cceb9196a66 (diff) | |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Bitcode/Writer')
| -rw-r--r-- | contrib/llvm-project/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp | 24 | ||||
| -rw-r--r-- | contrib/llvm-project/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp | 4 |
2 files changed, 8 insertions, 20 deletions
diff --git a/contrib/llvm-project/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp b/contrib/llvm-project/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp index 28941d6c41cf..93fb2a821dee 100644 --- a/contrib/llvm-project/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp +++ b/contrib/llvm-project/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp @@ -40,8 +40,6 @@ namespace { class WriteBitcodePass : public ModulePass { raw_ostream &OS; // raw_ostream to print on bool ShouldPreserveUseListOrder; - bool EmitSummaryIndex; - bool EmitModuleHash; public: static char ID; // Pass identification, replacement for typeid @@ -49,29 +47,23 @@ namespace { initializeWriteBitcodePassPass(*PassRegistry::getPassRegistry()); } - explicit WriteBitcodePass(raw_ostream &o, bool ShouldPreserveUseListOrder, - bool EmitSummaryIndex, bool EmitModuleHash) + explicit WriteBitcodePass(raw_ostream &o, bool ShouldPreserveUseListOrder) : ModulePass(ID), OS(o), - ShouldPreserveUseListOrder(ShouldPreserveUseListOrder), - EmitSummaryIndex(EmitSummaryIndex), EmitModuleHash(EmitModuleHash) { + ShouldPreserveUseListOrder(ShouldPreserveUseListOrder) { initializeWriteBitcodePassPass(*PassRegistry::getPassRegistry()); } StringRef getPassName() const override { return "Bitcode Writer"; } bool runOnModule(Module &M) override { - const ModuleSummaryIndex *Index = - EmitSummaryIndex - ? &(getAnalysis<ModuleSummaryIndexWrapperPass>().getIndex()) - : nullptr; // RemoveDIs: there's no bitcode representation of the DPValue debug-info, // convert to dbg.values before writing out. bool IsNewDbgInfoFormat = M.IsNewDbgInfoFormat; if (IsNewDbgInfoFormat) M.convertFromNewDbgValues(); - WriteBitcodeToFile(M, OS, ShouldPreserveUseListOrder, Index, - EmitModuleHash); + WriteBitcodeToFile(M, OS, ShouldPreserveUseListOrder, /*Index=*/nullptr, + /*EmitModuleHash=*/false); if (IsNewDbgInfoFormat) M.convertToNewDbgValues(); @@ -79,8 +71,6 @@ namespace { } void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); - if (EmitSummaryIndex) - AU.addRequired<ModuleSummaryIndexWrapperPass>(); } }; } @@ -93,10 +83,8 @@ INITIALIZE_PASS_END(WriteBitcodePass, "write-bitcode", "Write Bitcode", false, true) ModulePass *llvm::createBitcodeWriterPass(raw_ostream &Str, - bool ShouldPreserveUseListOrder, - bool EmitSummaryIndex, bool EmitModuleHash) { - return new WriteBitcodePass(Str, ShouldPreserveUseListOrder, - EmitSummaryIndex, EmitModuleHash); + bool ShouldPreserveUseListOrder) { + return new WriteBitcodePass(Str, ShouldPreserveUseListOrder); } bool llvm::isBitcodeWriterPass(Pass *P) { diff --git a/contrib/llvm-project/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp b/contrib/llvm-project/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp index 998f629aaa4e..fccb2a606f7e 100644 --- a/contrib/llvm-project/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp +++ b/contrib/llvm-project/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp @@ -1108,8 +1108,8 @@ void ValueEnumerator::purgeFunction() { /// Remove purged values from the ValueMap. for (unsigned i = NumModuleValues, e = Values.size(); i != e; ++i) ValueMap.erase(Values[i].first); - for (unsigned i = NumModuleMDs, e = MDs.size(); i != e; ++i) - MetadataMap.erase(MDs[i]); + for (const Metadata *MD : llvm::drop_begin(MDs, NumModuleMDs)) + MetadataMap.erase(MD); for (const BasicBlock *BB : BasicBlocks) ValueMap.erase(BB); |
