* [PATCH]middle-end Guard value_replacement and store_elim from seeing diamonds.
@ 2022-08-05 13:15 Tamar Christina
2022-08-05 13:47 ` Richard Biener
2023-03-30 22:58 ` Andrew Pinski
0 siblings, 2 replies; 3+ messages in thread
From: Tamar Christina @ 2022-08-05 13:15 UTC (permalink / raw)
To: gcc-patches; +Cc: nd, rguenther
[-- Attachment #1: Type: text/plain, Size: 1302 bytes --]
Hi All,
This excludes value_replacement and store_elim from diamonds as they don't
handle the form properly.
Bootstrapped Regtested on aarch64-none-linux-gnu, x86_64-pc-linux-gnu
and no issues.
Ok for master?
Thanks,
Tamar
gcc/ChangeLog:
PR middle-end/106534
* tree-ssa-phiopt.cc (tree_ssa_phiopt_worker): Guard the
value_replacement and store_elim from diamonds.
--- inline copy of patch --
diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
index bdbf52916b0f88ee4f475e1fa306046d61f13d53..1e002c608591836ffb001724b3f469a8d042ae5e 100644
--- a/gcc/tree-ssa-phiopt.cc
+++ b/gcc/tree-ssa-phiopt.cc
@@ -283,7 +283,7 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool do_hoist_loads, bool early_p)
|| (e1->flags & EDGE_FALLTHRU) == 0)
continue;
- if (do_store_elim)
+ if (do_store_elim && !diamond_p)
{
/* Also make sure that bb1 only have one predecessor and that it
is bb. */
@@ -310,7 +310,7 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool do_hoist_loads, bool early_p)
/* Value replacement can work with more than one PHI
so try that first. */
- if (!early_p)
+ if (!early_p && !diamond_p)
for (gsi = gsi_start (phis); !gsi_end_p (gsi); gsi_next (&gsi))
{
phi = as_a <gphi *> (gsi_stmt (gsi));
--
[-- Attachment #2: rb16124.patch --]
[-- Type: text/plain, Size: 894 bytes --]
diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
index bdbf52916b0f88ee4f475e1fa306046d61f13d53..1e002c608591836ffb001724b3f469a8d042ae5e 100644
--- a/gcc/tree-ssa-phiopt.cc
+++ b/gcc/tree-ssa-phiopt.cc
@@ -283,7 +283,7 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool do_hoist_loads, bool early_p)
|| (e1->flags & EDGE_FALLTHRU) == 0)
continue;
- if (do_store_elim)
+ if (do_store_elim && !diamond_p)
{
/* Also make sure that bb1 only have one predecessor and that it
is bb. */
@@ -310,7 +310,7 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool do_hoist_loads, bool early_p)
/* Value replacement can work with more than one PHI
so try that first. */
- if (!early_p)
+ if (!early_p && !diamond_p)
for (gsi = gsi_start (phis); !gsi_end_p (gsi); gsi_next (&gsi))
{
phi = as_a <gphi *> (gsi_stmt (gsi));
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH]middle-end Guard value_replacement and store_elim from seeing diamonds.
2022-08-05 13:15 [PATCH]middle-end Guard value_replacement and store_elim from seeing diamonds Tamar Christina
@ 2022-08-05 13:47 ` Richard Biener
2023-03-30 22:58 ` Andrew Pinski
1 sibling, 0 replies; 3+ messages in thread
From: Richard Biener @ 2022-08-05 13:47 UTC (permalink / raw)
To: Tamar Christina; +Cc: gcc-patches, nd
On Fri, 5 Aug 2022, Tamar Christina wrote:
> Hi All,
>
> This excludes value_replacement and store_elim from diamonds as they don't
> handle the form properly.
>
> Bootstrapped Regtested on aarch64-none-linux-gnu, x86_64-pc-linux-gnu
> and no issues.
>
> Ok for master?
OK
> Thanks,
> Tamar
>
> gcc/ChangeLog:
>
> PR middle-end/106534
> * tree-ssa-phiopt.cc (tree_ssa_phiopt_worker): Guard the
> value_replacement and store_elim from diamonds.
>
> --- inline copy of patch --
> diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
> index bdbf52916b0f88ee4f475e1fa306046d61f13d53..1e002c608591836ffb001724b3f469a8d042ae5e 100644
> --- a/gcc/tree-ssa-phiopt.cc
> +++ b/gcc/tree-ssa-phiopt.cc
> @@ -283,7 +283,7 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool do_hoist_loads, bool early_p)
> || (e1->flags & EDGE_FALLTHRU) == 0)
> continue;
>
> - if (do_store_elim)
> + if (do_store_elim && !diamond_p)
> {
> /* Also make sure that bb1 only have one predecessor and that it
> is bb. */
> @@ -310,7 +310,7 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool do_hoist_loads, bool early_p)
>
> /* Value replacement can work with more than one PHI
> so try that first. */
> - if (!early_p)
> + if (!early_p && !diamond_p)
> for (gsi = gsi_start (phis); !gsi_end_p (gsi); gsi_next (&gsi))
> {
> phi = as_a <gphi *> (gsi_stmt (gsi));
>
>
>
>
>
--
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg,
Germany; GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman;
HRB 36809 (AG Nuernberg)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH]middle-end Guard value_replacement and store_elim from seeing diamonds.
2022-08-05 13:15 [PATCH]middle-end Guard value_replacement and store_elim from seeing diamonds Tamar Christina
2022-08-05 13:47 ` Richard Biener
@ 2023-03-30 22:58 ` Andrew Pinski
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Pinski @ 2023-03-30 22:58 UTC (permalink / raw)
To: Tamar Christina; +Cc: gcc-patches, nd, rguenther
On Fri, Aug 5, 2022 at 6:16 AM Tamar Christina via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Hi All,
>
> This excludes value_replacement and store_elim from diamonds as they don't
> handle the form properly.
>
> Bootstrapped Regtested on aarch64-none-linux-gnu, x86_64-pc-linux-gnu
> and no issues.
>
> Ok for master?
I just noticed this changes the behavior of the store elimination pass
to also act like phi-opt if bb layout was a diamond.
I will be submitting a patch for GCC 14 to revert back that behavior
with some refactoring I am doing to improve the readability of the
code.
Thanks,
Andrew Pinski
>
> Thanks,
> Tamar
>
> gcc/ChangeLog:
>
> PR middle-end/106534
> * tree-ssa-phiopt.cc (tree_ssa_phiopt_worker): Guard the
> value_replacement and store_elim from diamonds.
>
> --- inline copy of patch --
> diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
> index bdbf52916b0f88ee4f475e1fa306046d61f13d53..1e002c608591836ffb001724b3f469a8d042ae5e 100644
> --- a/gcc/tree-ssa-phiopt.cc
> +++ b/gcc/tree-ssa-phiopt.cc
> @@ -283,7 +283,7 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool do_hoist_loads, bool early_p)
> || (e1->flags & EDGE_FALLTHRU) == 0)
> continue;
>
> - if (do_store_elim)
> + if (do_store_elim && !diamond_p)
> {
> /* Also make sure that bb1 only have one predecessor and that it
> is bb. */
> @@ -310,7 +310,7 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool do_hoist_loads, bool early_p)
>
> /* Value replacement can work with more than one PHI
> so try that first. */
> - if (!early_p)
> + if (!early_p && !diamond_p)
> for (gsi = gsi_start (phis); !gsi_end_p (gsi); gsi_next (&gsi))
> {
> phi = as_a <gphi *> (gsi_stmt (gsi));
>
>
>
>
> --
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-03-30 22:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-05 13:15 [PATCH]middle-end Guard value_replacement and store_elim from seeing diamonds Tamar Christina
2022-08-05 13:47 ` Richard Biener
2023-03-30 22:58 ` Andrew Pinski
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).