From: <apinski@marvell.com>
To: <gcc-patches@gcc.gnu.org>
Cc: Andrew Pinski <apinski@marvell.com>
Subject: [PATCH 2/7] Duplicate the range information of the phi onto the new ssa_name
Date: Sat, 19 Jun 2021 12:47:21 -0700 [thread overview]
Message-ID: <1624132041-665-2-git-send-email-apinski@marvell.com> (raw)
In-Reply-To: <1624132041-665-1-git-send-email-apinski@marvell.com>
From: Andrew Pinski <apinski@marvell.com>
Since match_simplify_replacement uses gimple_simplify, there is a new
ssa name created sometimes and then we go and replace the phi edge with
this new ssa name, the range information on the phi is lost.
I don't have a testcase right now where we lose the range information
though but it does show up when enhancing match.pd to handle
some min/max patterns and g++.dg/warn/Wstringop-overflow-1.C starts
to fail.
OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
gcc/ChangeLog:
* tree-ssa-phiopt.c (match_simplify_replacement): Duplicate range
info if we're the only things setting the target PHI.
---
gcc/tree-ssa-phiopt.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index 24cbce9955a..feb8ca8d0d1 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -894,6 +894,14 @@ match_simplify_replacement (basic_block cond_bb, basic_block middle_bb,
gsi_move_before (&gsi1, &gsi);
reset_flow_sensitive_info (gimple_assign_lhs (stmt_to_move));
}
+ /* Duplicate range info if we're the only things setting the target PHI. */
+ tree phi_result = PHI_RESULT (phi);
+ if (!gimple_seq_empty_p (seq)
+ && EDGE_COUNT (gimple_bb (phi)->preds) == 2
+ && !POINTER_TYPE_P (TREE_TYPE (phi_result))
+ && SSA_NAME_RANGE_INFO (phi_result))
+ duplicate_ssa_name_range_info (result, SSA_NAME_RANGE_TYPE (phi_result),
+ SSA_NAME_RANGE_INFO (phi_result));
if (seq)
gsi_insert_seq_before (&gsi, seq, GSI_SAME_STMT);
--
2.27.0
next prev parent reply other threads:[~2021-06-19 19:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-19 19:47 [PATCH 1/7] Reset the range info on the moved instruction in PHIOPT apinski
2021-06-19 19:47 ` apinski [this message]
2021-06-21 6:49 ` [PATCH 2/7] Duplicate the range information of the phi onto the new ssa_name Richard Biener
2021-06-23 0:19 ` Andrew Pinski
2021-06-23 7:29 ` Richard Biener
2021-06-21 6:42 ` [PATCH 1/7] Reset the range info on the moved instruction in PHIOPT 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=1624132041-665-2-git-send-email-apinski@marvell.com \
--to=apinski@marvell.com \
--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).