From: Andrew Pinski <pinskia@gmail.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Richard Biener <rguenther@suse.de>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 3/12] phiopt: Fix phiopt ICE on vops [PR102989]
Date: Wed, 9 Aug 2023 11:27:48 -0700 [thread overview]
Message-ID: <CA+=Sn1nJpUZcAFV_G18kCujdeszJY=yiLCh9ZxBDZ_sVf5A-hw@mail.gmail.com> (raw)
In-Reply-To: <ZNPYJTDaCXXiAkUh@tucnak>
On Wed, Aug 9, 2023 at 11:17 AM Jakub Jelinek via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Hi!
>
> I've ran into ICE on gcc.dg/torture/bitint-42.c with -O1 or -Os
> when enabling expensive tests, and unfortunately I can't reproduce without
> _BitInt. The IL before phiopt3 has:
> <bb 87> [local count: 203190070]:
> # .MEM_428 = VDEF <.MEM_367>
> bitint.159 = VIEW_CONVERT_EXPR<unsigned long[8]>(*.LC3);
> goto <bb 89>; [100.00%]
>
> <bb 88> [local count: 203190070]:
> # .MEM_427 = VDEF <.MEM_367>
> bitint.159 = VIEW_CONVERT_EXPR<unsigned long[8]>(*.LC4);
>
> <bb 89> [local count: 406380139]:
> # .MEM_368 = PHI <.MEM_428(87), .MEM_427(88)>
> # VUSE <.MEM_368>
> _123 = VIEW_CONVERT_EXPR<unsigned long[8]>(r495[i_107].D.2780)[0];
> and factor_out_conditional_operation is called on the vop PHI, it
> sees it has exactly two operands and defining statements of both
> PHI arguments are converts (VCEs in this case), so it thinks it is
> a good idea to try to optimize that and while doing that it constructs
> void type SSA_NAMEs and the like.
Maybe it is better to punt for VOPS after the call to
single_non_singleton_phi_for_edges since none of functions called
afterwards support VOPs.
That is something like:
diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
index ff36bb0119b..d0b659042a7 100644
--- a/gcc/tree-ssa-phiopt.cc
+++ b/gcc/tree-ssa-phiopt.cc
@@ -4165,6 +4165,10 @@ pass_phiopt::execute (function *)
arg0 = gimple_phi_arg_def (phi, e1->dest_idx);
arg1 = gimple_phi_arg_def (phi, e2->dest_idx);
+ /* Can't do anything with a VOP here. */
+ if (SSA_NAME_IS_VIRTUAL_OPERAND (arg0))
+ continue;
+
/* Something is wrong if we cannot find the arguments in the PHI
node. */
gcc_assert (arg0 != NULL_TREE && arg1 != NULL_TREE);
Thanks,
Andrew Pinski
>
> 2023-08-09 <jakub@redhat.com>
>
> PR c/102989
> * tree-ssa-phiopt.cc (factor_out_conditional_operation): Punt for
> vops.
>
> --- gcc/tree-ssa-phiopt.cc.jj 2023-08-08 15:55:09.508122417 +0200
> +++ gcc/tree-ssa-phiopt.cc 2023-08-09 15:55:23.762314103 +0200
> @@ -241,6 +241,7 @@ factor_out_conditional_operation (edge e
> }
>
> if (TREE_CODE (arg0) != SSA_NAME
> + || SSA_NAME_IS_VIRTUAL_OPERAND (arg0)
> || (TREE_CODE (arg1) != SSA_NAME
> && TREE_CODE (arg1) != INTEGER_CST))
> return NULL;
>
> Jakub
>
next prev parent reply other threads:[~2023-08-09 18:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-09 18:17 Jakub Jelinek
2023-08-09 18:27 ` Andrew Pinski [this message]
2023-08-09 20:00 ` Jakub Jelinek
2023-08-09 20:06 ` Andrew Pinski
2023-08-09 20:18 ` Jakub Jelinek
2023-08-10 6:52 ` 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='CA+=Sn1nJpUZcAFV_G18kCujdeszJY=yiLCh9ZxBDZ_sVf5A-hw@mail.gmail.com' \
--to=pinskia@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--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).