[igt-dev] [PATCH 5/6] scripts/code_cov_parse_info: take gcc IPA optimizations into account

Kamil Konieczny kamil.konieczny at linux.intel.com
Wed Oct 5 20:07:51 UTC 2022


On 2022-09-22 at 10:46:17 +0200, Mauro Carvalho Chehab wrote:
> From: Mauro Carvalho Chehab <mchehab at kernel.org>
> 
> When -O2/-O3 is used with GCC, IPA will produce function variants
> at the object code. So, for a function or macro foo(), it may
> produce several actual functions at the object code, like:
> 
> 	foo.isra.3
> 	foo.isra.4
> 
> For the purposes of code coverage, all of those are the same
> function, so use a regex with "\w+", which will exclude the
> .isra.<number>, considering all variants as the same function.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab at kernel.org>

Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>

> ---
> 
> To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
> See [PATCH 0/6] at: https://lore.kernel.org/all/cover.1663836123.git.mchehab@kernel.org/
> 
>  scripts/code_cov_parse_info | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/code_cov_parse_info b/scripts/code_cov_parse_info
> index e8bac730e88b..7f3e1f9ef116 100755
> --- a/scripts/code_cov_parse_info
> +++ b/scripts/code_cov_parse_info
> @@ -136,7 +136,9 @@ sub parse_info_data($)
>  		# Function coverage
>  
>  		# FN:<line number of function start>,<function name>
> -		if (m/^FN:(-?\d+),(.*)/) {
> +		# Note: /w+ intentionally removes IPA gcc-optimization names, as
> +		# this is more related to branch coverage
> +		if (m/^FN:(-?\d+),(\w+)/) {
>  			my $ln = $1;
>  
>  			$func = $2;
> @@ -156,7 +158,9 @@ sub parse_info_data($)
>  
>  		# Parse functions that were actually used
>  		# FNDA:<execution count>,<function name>
> -		if (m/^FNDA:(-?\d+),(.*)/) {
> +		# Note: /w+ intentionally removes IPA gcc-optimization names, as
> +		# this is more related to branch coverage
> +		if (m/^FNDA:(-?\d+),(\w+)/) {
>  			my $count = $1;
>  
>  			# Negative gcov results are possible, as reported at:
> -- 
> 2.37.2
> 


More information about the igt-dev mailing list