diff options
author | Teresa Johnson <tejohnson@google.com> | 2023-05-10 13:14:22 -0700 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2023-05-10 14:58:35 -0700 |
commit | 9e280c47588bfaf008a5fb091cd47df92b9c4264 (patch) | |
tree | da24419cd266b42d0173ea9d49cde69558882202 /llvm/lib/LTO/LTOBackend.cpp | |
parent | c7b291a63f5cabea47e1b4b13e7091e3e37dadb1 (diff) | |
download | llvm-9e280c47588bfaf008a5fb091cd47df92b9c4264.zip llvm-9e280c47588bfaf008a5fb091cd47df92b9c4264.tar.gz llvm-9e280c47588bfaf008a5fb091cd47df92b9c4264.tar.bz2 |
[MemProf] Update hot/cold information after importing
The support added by D149215 to remove memprof metadata and attributes
if we don't link with an allocator supporting hot/cold operator new
interfaces did not update imported code. Move the update handling later
in the ThinLTO backend to just after importing, and update the test to
check this case.
Differential Revision: https://reviews.llvm.org/D150295
Diffstat (limited to 'llvm/lib/LTO/LTOBackend.cpp')
-rw-r--r-- | llvm/lib/LTO/LTOBackend.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp index a18963f..a089cbe 100644 --- a/llvm/lib/LTO/LTOBackend.cpp +++ b/llvm/lib/LTO/LTOBackend.cpp @@ -565,8 +565,6 @@ Error lto::thinBackend(const Config &Conf, unsigned Task, AddStreamFn AddStream, // the module, if applicable. Mod.setPartialSampleProfileRatio(CombinedIndex); - updateMemProfAttributes(Mod, CombinedIndex); - updatePublicTypeTestCalls(Mod, CombinedIndex.withWholeProgramVisibility()); if (Conf.CodeGenOnly) { @@ -653,6 +651,9 @@ Error lto::thinBackend(const Config &Conf, unsigned Task, AddStreamFn AddStream, if (Error Err = Importer.importFunctions(Mod, ImportList).takeError()) return Err; + // Do this after any importing so that imported code is updated. + updateMemProfAttributes(Mod, CombinedIndex); + if (Conf.PostImportModuleHook && !Conf.PostImportModuleHook(Task, Mod)) return finalizeOptimizationRemarks(std::move(DiagnosticOutputFile)); |