From a55b8f199d88c8a2913ab6426bdca300fbaf6f3e Mon Sep 17 00:00:00 2001 From: Ilya Palachev Date: Mon, 29 Jun 2015 16:03:20 +0300 Subject: [PATCH] Added error on empty AutoFDO profiles SPEC CPU 2006 benchmarks showed regression in case when AutoFDO optimization is used with empty profiles. Such profiles usually has size of 1600 bytes and contain no actual information about feedback. Change-Id: I1972a1c5991aec3f58d1c9cd27d34d36699ee5dd Signed-off-by: Ilya Palachev --- gcc/auto-profile.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gcc/auto-profile.c b/gcc/auto-profile.c index 37f3ac7..428febe 100644 --- a/gcc/auto-profile.c +++ b/gcc/auto-profile.c @@ -302,6 +302,12 @@ public: /* Mark LOC as annotated. */ void mark_annotated (location_t loc); + /* Check whether the profile is empty. */ + bool empty() + { + return map_.empty(); + } + private: /* Map from function_instance name index (in string_table) to function_instance. */ @@ -918,6 +924,8 @@ read_profile (void) afdo_source_profile = autofdo_source_profile::create (); if (afdo_source_profile == NULL) error ("Cannot read function profile from %s.", auto_profile_file); + if (afdo_source_profile->empty ()) + error ("The given profile %s is empty.", auto_profile_file); /* autofdo_module_profile. */ fake_read_autofdo_module_profile (); -- 2.7.4