public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Andrew MacLeod <amacleod@redhat.com>
Cc: Jakub Jelinek <jakub@redhat.com>,
	Aldy Hernandez <aldyh@redhat.com>,
	 gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] PR tree-optimization/109274 -Fix compute_operand when op1 == op2 symbolically.
Date: Tue, 28 Mar 2023 15:28:21 +0200	[thread overview]
Message-ID: <CAFiYyc1udJO9e3BcVxsn53Zc8kf-3WoG-mqofzo_9AUf=ECftw@mail.gmail.com> (raw)
In-Reply-To: <c301a8d5-1331-1731-594c-d89eca395ceb@redhat.com>

On Tue, Mar 28, 2023 at 3:19 PM Andrew MacLeod <amacleod@redhat.com> wrote:
>
> On 3/24/23 12:36, Jakub Jelinek wrote:
> > On Fri, Mar 24, 2023 at 11:52:30AM -0400, Andrew MacLeod wrote:
> >> Thanks.. Ive incorporated it into my commit  too.
> > Note, both my earlier version of the patch and your patch regress:
> > FAIL: gcc.dg/tree-ssa/vrp-float-3a.c scan-tree-dump-not evrp "link_error"
> > FAIL: gcc.dg/tree-ssa/vrp-float-4a.c scan-tree-dump-not evrp "link_error"
> >
> >       Jakub
> >
> OK, that was fun.
>
> I commented in the PR, but the root issue is the way I was trying to
> communicate symbolic equivalence on operands to the compute_operand
> routines.
>
> [1, 1 ]= a_1 != a_1
>
> I was creating a relation record between op1 and op2 indicating they
> were equivalent.    THis record then gets passed up the gori call chain.
>
> Reality is that this is not a true equivalence... without looking a the
> ranges, we dont know that that is true for general application, and and
> furthermore, when applied to something like a1 != a1, you can see the
> problem...
>
> Once I corrected the value_relation record to create records with the
> same operand, things went south.
>
> What we really need is to locally identify when op1 and op2 are the same
> symbol, and if there is no other information, pass it locally on that
> one statement  to the range-op handler.
>
> Then, once we have processed the statement, we invoke the handler for
> that statement to cvreate a record which is passed up the chain.
> so for:
>
>      a_1 = b_4 + 1.0
>      [1, 1] = (a_1 != a_1)
>
> compute_operand_1 starts with no relation record, recognizes
> symbolically op1 and op2 are the same, and passes EQ_EXPR locally as the
> op1_op2 relation to the handler for NE_EXPR.   That handler utilizes the
> range of op2 to detemine whether != is true or not based on knowledge
> that op1 and op2 are the same value.     (for integer always false, for
> float, takes a look at NAN) and produces a result.
>
> Before invoking compute_operand to calculate b_4 with the result of a_1,
>    handler.op1_op2_relation (lhs);
> is invoked to determine if there is a relation generated by the
> statement, which will generate  (a_1 != a_1), and pass that to compute
> operand for use in evaluating b_4.
>
> Bootstraps on x86_64-pc-linux-gnu with no regressions.  OK for trunk?

LGTM.

Thanks,
Richard.

> Andrew

      reply	other threads:[~2023-03-28 13:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-24 15:08 [PATCH] PR tree-optimization/109274 - Don't interpret contents of a value_relation record Andrew MacLeod
2023-03-24 15:15 ` Jakub Jelinek
2023-03-24 15:52   ` Andrew MacLeod
2023-03-24 16:36     ` Jakub Jelinek
2023-03-28 13:19       ` [PATCH] PR tree-optimization/109274 -Fix compute_operand when op1 == op2 symbolically Andrew MacLeod
2023-03-28 13:28         ` Richard Biener [this message]

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='CAFiYyc1udJO9e3BcVxsn53Zc8kf-3WoG-mqofzo_9AUf=ECftw@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=aldyh@redhat.com \
    --cc=amacleod@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    /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).