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/104526] [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs. 11.2.0)
Date: Wed, 16 Feb 2022 14:05:23 +0000	[thread overview]
Message-ID: <bug-104526-4-Gtw3jMbLLE@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104526-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #7 from Andrew Macleod <amacleod at redhat dot com> ---
On 2/16/22 07:39, jakub at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104526
>
> --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> +  tree type = TREE_TYPE (TREE_OPERAND (cond, 0));
> +  if (type != TREE_TYPE (TREE_OPERAND (cond, 1)))
> +    return false;
> looks unnecessarily restrictive.
> What tree-cfg.cc verification guarantees (and no need to check it in the
> ranger)
> is what verify_gimple_comparison verifies, i.e. that
>    /* For comparisons we do not have the operations type as the
>       effective type the comparison is carried out in.  Instead
>       we require that either the first operand is trivially
>       convertible into the second, or the other way around.  */
>    if (!useless_type_conversion_p (op0_type, op1_type)
>        && !useless_type_conversion_p (op1_type, op0_type))
> I think the ranger has to be prepared for non-pointer-equal type mismatches as
> long as they are useless_type_conversion_p compatible, that can happen anywhere
> in the IL, including even cases like different but useless_type_conversion_p
> compatible types of binary operators like +, -, * etc.
> So I'd just remove the
>    if (type != TREE_TYPE (TREE_OPERAND (cond, 1)))
>      return false;
> lines.

The rest of ranger isn't this restrictive.. it is satisfied by 
range_compatable_p() which boils down to "same precision, same sign".

I added it here so to be super paranoid so I didn't get caught by 
something unexpected later in the routine and cause an ICE in intersect 
in the middle of building the kernel or something.  In hindsight, I 
should have used range_compatible_p...

Are you OK with the following change?  I'll bootstrap and regression test...

Andrew

  parent reply	other threads:[~2022-02-16 14:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-14 10:07 [Bug tree-optimization/104526] New: " theodort at inf dot ethz.ch
2022-02-14 10:12 ` [Bug tree-optimization/104526] " rguenth at gcc dot gnu.org
2022-02-14 13:41 ` jakub at gcc dot gnu.org
2022-02-14 14:33 ` jakub at gcc dot gnu.org
2022-02-14 22:14 ` amacleod at redhat dot com
2022-02-15 22:12 ` cvs-commit at gcc dot gnu.org
2022-02-15 22:13 ` amacleod at redhat dot com
2022-02-16 12:39 ` jakub at gcc dot gnu.org
2022-02-16 14:05 ` amacleod at redhat dot com [this message]
2022-02-16 14:07 ` jakub 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-104526-4-Gtw3jMbLLE@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).