public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/114269] [14 Regression] Multiple 3-27% exec time regressions of 434.zeusmp since r14-9193-ga0b1798042d033
Date: Fri, 08 Mar 2024 12:23:58 +0000	[thread overview]
Message-ID: <bug-114269-4-S4HWJTF8UJ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114269-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
The following is a C testcase for a case where ranges will not help:

void foo (int *a, long js, long je, long is, long ie, long ks, long ke, long
xi, long xj)
{
  for (long j = js; j < je; ++j)
    for (long i = is; i < ie; ++i)
      for (long k = ks; k < ke; ++k)
        a[i + j*xi + k*xi*xj] = 5;
}

SCEV analysis result before/after shows issues.  When you re-order the loops
so the fast increment goes innermost this doesn't make a difference for
vectorization though.  In the order above we now require (emulated) gather
which with SSE didn't work out and previously we used strided stores.

The reason seems to be that when analyzing k*xi*xj the first multiply
yields

(long int) {(unsigned long) ks_21(D) * (unsigned long) xi_24(D), +, (unsigned
long) xi_24(D)}_3

but when then asking to fold the multiply by xj we fail as we run into

tree
chrec_fold_multiply (tree type,
                     tree op0,
                     tree op1)
{         
...
    CASE_CONVERT:
      if (tree_contains_chrecs (op0, NULL))
        return chrec_dont_know;
      /* FALLTHRU */ 

but this case is somewhat odd as all other unhandled cases simply run into
fold_build2.  This possibly means we'd never build other ops with
CHREC operands.  This was added for PR42326.

I think we can handle sign-conversions from unsigned just fine, chrec_fold_plus
does such thing already (but it misses one case).

Doing this restores things to some extent.

I'm testing this as an intermediate step before considering reversion of the
change.

  parent reply	other threads:[~2024-03-08 12:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-07 15:30 [Bug tree-optimization/114269] New: " pheeck at gcc dot gnu.org
2024-03-08  8:18 ` [Bug tree-optimization/114269] " rguenth at gcc dot gnu.org
2024-03-08 10:08 ` xry111 at gcc dot gnu.org
2024-03-08 10:25 ` rguenth at gcc dot gnu.org
2024-03-08 12:23 ` rguenth at gcc dot gnu.org [this message]
2024-03-08 13:41 ` cvs-commit at gcc dot gnu.org
2024-03-08 13:41 ` rguenth at gcc dot gnu.org
2024-03-12 12:48 ` [Bug tree-optimization/114269] [14 Regression] Multiple 3-6% " pheeck at gcc dot gnu.org
2024-03-15 15:01 ` law at gcc dot gnu.org
2024-03-19 12:12 ` cvs-commit at gcc dot gnu.org
2024-03-19 12:15 ` rguenth at gcc dot gnu.org

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-114269-4-S4HWJTF8UJ@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).