diff mbox

[1/4] Make coverage_compute_cfg_checksum callable with an argument

Message ID 53882970.2000402@suse.cz
State New
Headers show

Commit Message

Martin Liška May 30, 2014, 6:47 a.m. UTC
Hello,
   this is a small patchset that prepares API for new IPA Identical code folding pass. The patch adds an argument for coverage_compute_cfg_checksum.

Bootstrapped and tested on x86_64-linux.
OK for trunk?

Thanks,
Martin

2014-05-29  Martin Liska  <mliska@suse.cz>

	* coverage.h (coverage_compute_cfg_checksum): Argument added.
	* coverage.c (coverage_compute_cfg_checksum): Likewise.
	* profile.c (branch_prob): Likewise.

Comments

Jeff Law May 30, 2014, 4:28 p.m. UTC | #1
On 05/30/14 00:47, Martin Liška wrote:
> Hello,
>    this is a small patchset that prepares API for new IPA Identical code
> folding pass. The patch adds an argument for coverage_compute_cfg_checksum.
>
> Bootstrapped and tested on x86_64-linux.
> OK for trunk?
>
> Thanks,
> Martin
>
> 2014-05-29  Martin Liska  <mliska@suse.cz>
>
>      * coverage.h (coverage_compute_cfg_checksum): Argument added.
>      * coverage.c (coverage_compute_cfg_checksum): Likewise.
>      * profile.c (branch_prob): Likewise.
The block comment for coverage_compute_cfg_checksum needs to be updated. 
  We're no longer computing the checksum for the current function 
(cfun), but instead computing the checksum for the argument FN.


Otherwise OK for the trunk.

jeff
Martin Liška June 2, 2014, 2:11 p.m. UTC | #2
On 05/30/2014 06:28 PM, Jeff Law wrote:
> On 05/30/14 00:47, Martin Liška wrote:
>> Hello,
>>    this is a small patchset that prepares API for new IPA Identical code
>> folding pass. The patch adds an argument for coverage_compute_cfg_checksum.
>>
>> Bootstrapped and tested on x86_64-linux.
>> OK for trunk?
>>
>> Thanks,
>> Martin
>>
>> 2014-05-29  Martin Liska  <mliska@suse.cz>
>>
>>      * coverage.h (coverage_compute_cfg_checksum): Argument added.
>>      * coverage.c (coverage_compute_cfg_checksum): Likewise.
>>      * profile.c (branch_prob): Likewise.
> The block comment for coverage_compute_cfg_checksum needs to be updated.  We're no longer computing the checksum for the current function (cfun), but instead computing the checksum for the argument FN.

Hi,
    thank you for your feedback, I've just fixed the patch and will commit soon.

Martin

>
>
> Otherwise OK for the trunk.
>
> jeff
diff mbox

Patch

diff --git a/gcc/coverage.c b/gcc/coverage.c
index 5e9005e..9d81387 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -594,12 +594,12 @@  coverage_compute_profile_id (struct cgraph_node *n)
     but the compiler won't detect the change and use the wrong profile data.  */
  
  unsigned
-coverage_compute_cfg_checksum (void)
+coverage_compute_cfg_checksum (struct function *fn)
  {
    basic_block bb;
-  unsigned chksum = n_basic_blocks_for_fn (cfun);
+  unsigned chksum = n_basic_blocks_for_fn (fn);
  
-  FOR_EACH_BB_FN (bb, cfun)
+  FOR_EACH_BB_FN (bb, fn)
      {
        edge e;
        edge_iterator ei;
diff --git a/gcc/coverage.h b/gcc/coverage.h
index 81f87a6..392080c 100644
--- a/gcc/coverage.h
+++ b/gcc/coverage.h
@@ -32,8 +32,8 @@  extern int coverage_begin_function (unsigned, unsigned);
  /* Complete the coverage information for the current function.  */
  extern void coverage_end_function (unsigned, unsigned);
  
-/* Compute the control flow checksum for the current function.  */
-extern unsigned coverage_compute_cfg_checksum (void);
+/* Compute the control flow checksum for the FUNCTION given as argument.  */
+extern unsigned coverage_compute_cfg_checksum (struct function *);
  
  /* Compute the profile id of function N.  */
  extern unsigned coverage_compute_profile_id (struct cgraph_node *n);
diff --git a/gcc/profile.c b/gcc/profile.c
index 3282ee7..4e82eab 100644
--- a/gcc/profile.c
+++ b/gcc/profile.c
@@ -1195,7 +1195,7 @@  branch_prob (void)
       the checksum in only once place, since it depends on the shape
       of the control flow which can change during
       various transformations.  */
-  cfg_checksum = coverage_compute_cfg_checksum ();
+  cfg_checksum = coverage_compute_cfg_checksum (cfun);
    lineno_checksum = coverage_compute_lineno_checksum ();
  
    /* Write the data from which gcov can reconstruct the basic block