aboutsummaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2025-07-03 12:05:45 +0200
committerJan Hubicka <hubicka@ucw.cz>2025-07-03 12:05:45 +0200
commit99f9e90160cb83b09ec7421e9b53e4fffe3ee5ec (patch)
treedcff817b6a177da86af60d99e881e25c06e3d108 /libcpp
parentd52b0327a17f5ed12038bd83002627aac5b4b944 (diff)
downloadgcc-99f9e90160cb83b09ec7421e9b53e4fffe3ee5ec.zip
gcc-99f9e90160cb83b09ec7421e9b53e4fffe3ee5ec.tar.gz
gcc-99f9e90160cb83b09ec7421e9b53e4fffe3ee5ec.tar.bz2
Add -Wauto-profile warning
this patch adds new warning -Wauto-profile which warns about mismatches between profile data and function bodies. This is implemented during the offline pass where every function instance is compared with actual gimple body (if available) and we verify that the statement locations in the profile data can be matched with statements in the function. Currently it is mostly useful to find bugs, but eventually I hope it will be useful for users to verify that auto-profile works as expected or to evaulate how much of an old auto-profile data can still be applied to current sources. There will probably be always some side cases we can not handle with auto-profile format (such as function with bodies in mutlple files) that can be patched in compiled program. I also added logic to fix up missing discriminators in the function callsites. I am not sure how those happens (but seem to go away with -fno-crossjumping) and will dig into it. Ohter problem is that without -flto at the train run inlined functions have dwarf names rather than symbol names. LLVM solves this by -gdebug-for-autoprofile flag that we could also have. With this flag we could output assembler names as well as multiplicities of statemnets. Building SPECint there are approx 7k profile mismatches. Bootstrapped/regtested x86_64-linux. Plan to commit it after some extra testing. gcc/ChangeLog: * auto-profile.cc (get_combined_location): Handle negative offsets; output better diagnostics. (get_relative_location_for_locus): Reutrn -1 for unknown location. (function_instance::get_cgraph_node): New member function. (match_with_target): New function. (dump_stmt): New function. (function_instance::lookup_count): New function. (mark_expr_locations): New function. (function_instance::match): New function. (autofdo_source_profile::offline_external_functions): Do not repeat renaming; manage two worklists and do matching. (autofdo_source_profile::offline_unrealized_inlines): Simplify. (afdo_set_bb_count): do not look for lost discriminators. (auto_profile): Do not ICE when profile reading failed. * common.opt (Wauto-profile): New warning flag * doc/invoke.texi (-Wauto-profile): Document.
Diffstat (limited to 'libcpp')
0 files changed, 0 insertions, 0 deletions