public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Richard Biener <rguenther@suse.de>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] veclower: Fix up -fcompare-debug issue in expand_vector_comparison [PR104307]
Date: Tue, 1 Feb 2022 10:46:45 +0100	[thread overview]
Message-ID: <20220201094645.GU2646553@tucnak> (raw)
In-Reply-To: <123o499-251p-rp9r-64pr-p6734729qpr6@fhfr.qr>

On Tue, Feb 01, 2022 at 10:29:03AM +0100, Richard Biener wrote:
> So I think it's all fine besides the handling of VEC_COND_EXPRs where
> the use is in rhs1 and rhs2 and/or rhs3 - I don't really understand
> your worry here but shouldn't the stmt end up on the vector at least
> once?  You can use gimple_assign_rhs1_ptr to see whether the

My worry is that
  FOR_EACH_IMM_USE_FAST (use_p, iterator, lhs)
    uses.safe_push (USE_STMT (use_p));
for a stmt with multiple uses of lhs pushes the same
stmt multiple times.
And then
      if (a_is_comparison)
        a = gimplify_build2 (gsi, code, type, a1, a2);
      a1 = gimplify_build2 (gsi, BIT_AND_EXPR, type, a, b);
      a2 = gimplify_build1 (gsi, BIT_NOT_EXPR, type, a);
      a2 = gimplify_build2 (gsi, BIT_AND_EXPR, type, a2, c);
      a = gimplify_build2 (gsi, BIT_IOR_EXPR, type, a1, a2);
      gimple_assign_set_rhs_from_tree (gsi, a);
      update_stmt (gsi_stmt (*gsi));
will modify it (though the above at least will not remove the
stmt and update it in place I think) and then it won't be
a VEC_COND_EXPR anymore.
To me the non-cond uses in VEC_COND_EXPR conceptually look like
any other unhandled uses that the second loop clears
vec_cond_expr_only on.  But I don't have a testcase, dunno if it is even
possible.

> use is the rhs1 use comparing that with USE_PTR IIRC.  Btw, if you
> never push VEC_COND_EXPRs with such double-use it's not necessary
> to check again in the second loop?

I was just trying to be extra cautious in case expand_vector_comparison
modifies some other stmts, but maybe it is just expand_vector_comparison
in veclower and no other function that modifies anything but the
current stmt (+ pushes some new preparation statements and follow-up
statements).
So perhaps indeed:
+  if (vec_cond_expr_only)
+    for (gimple *use : uses)
+      {
+	gimple_stmt_iterator it = gsi_for_stmt (use);
+	if (!expand_vector_condition (&it, dce_ssa_names))
+	  {
+	    vec_cond_expr_only = false;
+	    break;
+	  }
+      }
for the second loop is enough.

But sure, if you prefer all I can do:
   FOR_EACH_IMM_USE_FAST (use_p, iterator, lhs)
-    uses.safe_push (USE_STMT (use_p));
+    if (!is_gimple_debug (USE_STMT (use_p)))
+      uses.safe_push (USE_STMT (use_p));

and keep the rest for GCC 13.

	Jakub


  reply	other threads:[~2022-02-01  9:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-01  9:18 Jakub Jelinek
2022-02-01  9:29 ` Richard Biener
2022-02-01  9:46   ` Jakub Jelinek [this message]
2022-02-01  9:56     ` Richard Biener

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=20220201094645.GU2646553@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rguenther@suse.de \
    /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).