@@ -1257,38 +1257,6 @@ Error LTO::run(AddStreamFn AddStream, FileCache Cache) {
12571257 return Result;
12581258}
12591259
1260- void lto::updateMemProfAttributes (Module &Mod,
1261- const ModuleSummaryIndex &Index) {
1262- llvm::TimeTraceScope timeScope (" LTO update memprof attributes" );
1263- if (Index.withSupportsHotColdNew ())
1264- return ;
1265-
1266- // The profile matcher applies hotness attributes directly for allocations,
1267- // and those will cause us to generate calls to the hot/cold interfaces
1268- // unconditionally. If supports-hot-cold-new was not enabled in the LTO
1269- // link then assume we don't want these calls (e.g. not linking with
1270- // the appropriate library, or otherwise trying to disable this behavior).
1271- for (auto &F : Mod) {
1272- for (auto &BB : F) {
1273- for (auto &I : BB) {
1274- auto *CI = dyn_cast<CallBase>(&I);
1275- if (!CI)
1276- continue ;
1277- if (CI->hasFnAttr (" memprof" ))
1278- CI->removeFnAttr (" memprof" );
1279- // Strip off all memprof metadata as it is no longer needed.
1280- // Importantly, this avoids the addition of new memprof attributes
1281- // after inlining propagation.
1282- // TODO: If we support additional types of MemProf metadata beyond hot
1283- // and cold, we will need to update the metadata based on the allocator
1284- // APIs supported instead of completely stripping all.
1285- CI->setMetadata (LLVMContext::MD_memprof, nullptr );
1286- CI->setMetadata (LLVMContext::MD_callsite, nullptr );
1287- }
1288- }
1289- }
1290- }
1291-
12921260Error LTO::runRegularLTO (AddStreamFn AddStream) {
12931261 llvm::TimeTraceScope timeScope (" Run regular LTO" );
12941262 LLVMContext &CombinedCtx = RegularLTO.CombinedModule ->getContext ();
@@ -1346,8 +1314,6 @@ Error LTO::runRegularLTO(AddStreamFn AddStream) {
13461314 }
13471315 }
13481316
1349- updateMemProfAttributes (*RegularLTO.CombinedModule , ThinLTO.CombinedIndex );
1350-
13511317 bool WholeProgramVisibilityEnabledInLTO =
13521318 Conf.HasWholeProgramVisibility &&
13531319 // If validation is enabled, upgrade visibility only when all vtables
0 commit comments