public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenther at suse dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/114932] IVopts inefficient handling of signed IV used for addressing.
Date: Thu, 06 Jun 2024 06:17:10 +0000 [thread overview]
Message-ID: <bug-114932-4-A03bBFs2dP@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114932-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114932
--- Comment #12 from rguenther at suse dot de <rguenther at suse dot de> ---
On Wed, 5 Jun 2024, tnfchris at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114932
>
> --- Comment #11 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
> (In reply to Richard Biener from comment #10)
> > I think the question is why IVOPTs ends up using both the signed and
> > unsigned variant of the same IV instead of expressing all uses of both with
> > one IV?
> >
> > That's where I'd look into.
>
> It looks like this is because of a subtle difference in the expressions.
>
> In get_loop_invariant_expr IVOPTs first tries to strip away all casts with
> STRIP_NOPS.
>
> The first expression is (unsigned long) (stride.3_27 * 4) and the second
> expression is ((unsigned long) stride.3_27) * 4 (The pretty printing here is
> pretty bad...)
>
> So the first one becomes:
> (unsigned long) (stride.3_27 * 4) -> stride.3_27 * 4
>
> and second one:
> ((unsigned long) stride.3_27) * 4 -> ((unsigned long) stride.3_27) * 4
>
> since we don't care about overflow here, it looks like the stripping should
> be recursive as long as it's a NOP expression between two integral types.
>
> That would get them to hash to the same IV expression. Trying now..
Note tree-affine is a tool that's used for this kind of "weak" equalities.
Convert both to affine, subtract them and if that's zero they are equal.
next prev parent reply other threads:[~2024-06-06 6:17 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-03 5:51 [Bug tree-optimization/114932] New: Improvement in CHREC can give large performance gains tnfchris at gcc dot gnu.org
2024-05-03 6:26 ` [Bug tree-optimization/114932] " rguenth at gcc dot gnu.org
2024-05-03 7:03 ` pinskia at gcc dot gnu.org
2024-05-03 8:09 ` tnfchris at gcc dot gnu.org
2024-05-03 8:41 ` tnfchris at gcc dot gnu.org
2024-05-03 8:44 ` tnfchris at gcc dot gnu.org
2024-05-03 8:45 ` tnfchris at gcc dot gnu.org
2024-05-03 9:12 ` rguenth at gcc dot gnu.org
2024-05-13 8:28 ` tnfchris at gcc dot gnu.org
2024-06-05 9:42 ` [Bug tree-optimization/114932] IVopts inefficient handling of signed IV used for addressing tnfchris at gcc dot gnu.org
2024-06-05 10:23 ` rguenth at gcc dot gnu.org
2024-06-05 19:02 ` tnfchris at gcc dot gnu.org
2024-06-06 6:17 ` rguenther at suse dot de [this message]
2024-06-06 6:40 ` tnfchris at gcc dot gnu.org
2024-06-06 7:55 ` rguenther at suse dot de
2024-06-06 8:01 ` tnfchris 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-114932-4-A03bBFs2dP@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).