public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r11-6973] rtl-optimization/98863 - fix PRE/CPROP memory usage check
Date: Fri, 29 Jan 2021 13:01:46 +0000 (GMT)	[thread overview]
Message-ID: <20210129130146.1CC283938C11@sourceware.org> (raw)

https://gcc.gnu.org/g:cb52e59e33845152cef6f9042a142a246e9447f6

commit r11-6973-gcb52e59e33845152cef6f9042a142a246e9447f6
Author: Richard Biener <rguenther@suse.de>
Date:   Fri Jan 29 13:25:49 2021 +0100

    rtl-optimization/98863 - fix PRE/CPROP memory usage check
    
    This fixes overflow of the memory usage estimate in turn failing
    to disable itself on WRF with LTO, causing a few GBs worth of
    memory peak.
    
    2021-01-29  Richard Biener  <rguenther@suse.de>
    
            PR rtl-optimization/98863
            * gcse.c (gcse_or_cprop_is_too_expensive): Use unsigned
            HOST_WIDE_INT for the memory estimate.

Diff:
---
 gcc/gcse.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/gcc/gcse.c b/gcc/gcse.c
index c4a6acb8aa1..29c9f900a8c 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -3982,9 +3982,9 @@ update_ld_motion_stores (struct gcse_expr * expr)
 bool
 gcse_or_cprop_is_too_expensive (const char *pass)
 {
-  int memory_request = (n_basic_blocks_for_fn (cfun)
-			* SBITMAP_SET_SIZE (max_reg_num ())
-			* sizeof (SBITMAP_ELT_TYPE));
+  unsigned HOST_WIDE_INT memory_request
+    = ((unsigned HOST_WIDE_INT)n_basic_blocks_for_fn (cfun)
+       * SBITMAP_SET_SIZE (max_reg_num ()) * sizeof (SBITMAP_ELT_TYPE));
   
   /* Trying to perform global optimizations on flow graphs which have
      a high connectivity will take a long time and is unlikely to be
@@ -4007,11 +4007,12 @@ gcse_or_cprop_is_too_expensive (const char *pass)
 
   /* If allocating memory for the dataflow bitmaps would take up too much
      storage it's better just to disable the optimization.  */
-  if (memory_request > param_max_gcse_memory)
+  if (memory_request > (unsigned HOST_WIDE_INT)param_max_gcse_memory)
     {
       warning (OPT_Wdisabled_optimization,
 	       "%s: %d basic blocks and %d registers; "
-	       "increase %<--param max-gcse-memory%> above %d",
+	       "increase %<--param max-gcse-memory%> above "
+	       HOST_WIDE_INT_PRINT_UNSIGNED,
 	       pass, n_basic_blocks_for_fn (cfun), max_reg_num (),
 	       memory_request);


                 reply	other threads:[~2021-01-29 13:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210129130146.1CC283938C11@sourceware.org \
    --to=rguenth@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).