public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "amacleod at redhat dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/100081] [11 Regression] Compile time hog in irange since r11-4135-ge864d395b4e862ce
Date: Fri, 16 Apr 2021 18:06:17 +0000	[thread overview]
Message-ID: <bug-100081-4-6E1YenGvsz@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-100081-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100081

--- Comment #8 from Andrew Macleod <amacleod at redhat dot com> ---
OMG.  Don't bother reducing. I can see the problem.

EVRP is fine, but when wrestrict runs, its quite late, and the CFG has

<bb 560> [local count: 28382607]:
  <...>
  _571 = _61 >= _593;
  _3583 = &arr_724 + _3992;
  _2220 = _831 <= _3583;
  _47 = _571 | _2220;
  _2935 = _376 * 2;
  _3966 = &arr_725 + _2935;
  _3024 = _61 >= _3966;
  _4219 = _3992 * 2;
  _4218 = &arr_725 + _4219;
  _1836 = _831 <= _4218;
  _3080 = _1836 | _3024;
<...>
  _5348 = _5347 & _32080;
  _5349 = _5348 & _32151;
  _5350 = _5349 & _32176;
  _5351 = _5350 & _32488;
  _5352 = _5351 & _33691;
  _5353 = _5352 & _33762;
  _5354 = _5353 & _34753;
  _35662 = _5354 & _34824;
  if (_35662 != 0)
    goto <bb 561>; [90.00%]
  else
    goto <bb 1510>; [10.00%]

Its a 7200 stmt basic block, made up of calculations and 2614 ORs and 1480
ANDs.

A request is made for a range which can be exported from this block, and ranger
is dutifully trying everything it can to process those blocks.

 Each AND/OR is a logical expression which evaluates a TRUE and FALSE range for
each operands, so it calculates up to 4 ranges for each pair of operands. I
knew this could get out of hand in pathological cases, so we introduced a
logical cache to help resolve this and avoid extra work.  Its actually making
this one worse I think.

Regardless, I know what the issue is.  I have 2 things to try.
1) We have a patch in our branch that gives up early.. once it finds the result
is going to be varying...   I'll give that a shot first, it may stop this
lookup quickly. Its possible it won't. 

if not, then 
2) we've also discussed that in ridiculously large combinations of &&/|| we are
unlikely to be able to haul a useful range out of it, so limit the depth of
logical processing to something in a reasonable range. 4000 logicals operations
is not reasonable to look thru.  something more akin to 10 maybe at most..

Anyway, I know what the issue is and will have it resolved early next week at
the latest.

  parent reply	other threads:[~2021-04-16 18:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14 14:21 [Bug tree-optimization/100081] New: " marxin at gcc dot gnu.org
2021-04-14 14:21 ` [Bug tree-optimization/100081] " marxin at gcc dot gnu.org
2021-04-14 14:22 ` marxin at gcc dot gnu.org
2021-04-15  6:45 ` rguenth at gcc dot gnu.org
2021-04-16 12:30 ` rguenth at gcc dot gnu.org
2021-04-16 12:39 ` rguenth at gcc dot gnu.org
2021-04-16 13:54 ` aldyh at gcc dot gnu.org
2021-04-16 14:04 ` aldyh at gcc dot gnu.org
2021-04-16 14:24 ` marxin at gcc dot gnu.org
2021-04-16 18:06 ` amacleod at redhat dot com [this message]
2021-04-16 18:39 ` amacleod at redhat dot com
2021-04-19  6:56 ` rguenth at gcc dot gnu.org
2021-04-19  7:30 ` marxin at gcc dot gnu.org
2021-04-19 14:09 ` amacleod at redhat dot com
2021-04-19 19:49 ` cvs-commit at gcc dot gnu.org
2021-04-27 11:40 ` [Bug tree-optimization/100081] [11/12 " jakub at gcc dot gnu.org
2021-07-14 18:32 ` amacleod at redhat dot com
2022-01-26 15:45 ` amacleod at redhat dot com

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=bug-100081-4-6E1YenGvsz@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).