From 572dd0dd8db4bec69883c0b3e53013a7842e886e Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Fri, 6 Jun 2025 10:56:51 +0200 Subject: [PATCH] Avoid useless reading of profile data in LTO New auto-profile merging dumps made me notice that we read the afdo data when we are in LTO. This is not necessary since profile is read at compile time and streamed to LTO bytecode. gcc/ChangeLog: * coverage.cc (coverage_init): Return early when in LTO --- gcc/coverage.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/coverage.cc b/gcc/coverage.cc index 7181e757359..c0ae76a40ef 100644 --- a/gcc/coverage.cc +++ b/gcc/coverage.cc @@ -1253,6 +1253,9 @@ coverage_obj_finish (vec *ctor, void coverage_init (const char *filename) { + /* If we are in LTO, the profile will be read from object files. */ + if (in_lto_p) + return; const char *original_filename = filename; int original_len = strlen (original_filename); #if HAVE_DOS_BASED_FILE_SYSTEM -- 2.47.2