From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] tree-optimization/100414 - compute dominance info in phiopt
Date: Tue, 4 May 2021 15:50:58 +0200 (CEST) [thread overview]
Message-ID: <nycvar.YFH.7.76.2105041550380.3852@elmra.sevgm.obk> (raw)
phiopt now has dominator queries but fails to compute dominance
info.
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.
2021-05-04 Richard Biener <rguenther@suse.de>
PR tree-optimization/100414
* tree-ssa-phiopt.c (get_non_trapping): Do not compute dominance
info here.
(tree_ssa_phiopt_worker): But unconditionally here.
* gcc.dg/pr100414.c: New testcase.
---
gcc/testsuite/gcc.dg/pr100414.c | 9 +++++++++
gcc/tree-ssa-phiopt.c | 5 ++---
2 files changed, 11 insertions(+), 3 deletions(-)
create mode 100644 gcc/testsuite/gcc.dg/pr100414.c
diff --git a/gcc/testsuite/gcc.dg/pr100414.c b/gcc/testsuite/gcc.dg/pr100414.c
new file mode 100644
index 00000000000..7876f6b56e9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr100414.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fno-tree-dce -fno-tree-dse -fchecking" } */
+
+int i;
+void
+foo (void)
+{
+ i &= i && __builtin_bswap16 (i);
+}
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index 35ce51e5977..5c18ea16600 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -174,6 +174,8 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool do_hoist_loads, bool early_p)
bool cfgchanged = false;
hash_set<tree> *nontrap = 0;
+ calculate_dominance_info (CDI_DOMINATORS);
+
if (do_store_elim)
/* Calculate the set of non-trapping memory accesses. */
nontrap = get_non_trapping ();
@@ -2438,9 +2440,6 @@ get_non_trapping (void)
{
nt_call_phase = 0;
hash_set<tree> *nontrap = new hash_set<tree>;
- /* We're going to do a dominator walk, so ensure that we have
- dominance information. */
- calculate_dominance_info (CDI_DOMINATORS);
nontrapping_dom_walker (CDI_DOMINATORS, nontrap)
.walk (cfun->cfg->x_entry_block_ptr);
--
2.26.2
reply other threads:[~2021-05-04 13:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=nycvar.YFH.7.76.2105041550380.3852@elmra.sevgm.obk \
--to=rguenther@suse.de \
--cc=gcc-patches@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).