From: Richard Sandiford <richard.sandiford@arm.com>
To: gcc-patches@gcc.gnu.org
Cc: jlaw@ventanamicro.com
Subject: [PATCH 06/12] mode-switching: Tweak entry/exit handling
Date: Sun, 05 Nov 2023 18:48:07 +0000 [thread overview]
Message-ID: <mpt4ji082ag.fsf@arm.com> (raw)
In-Reply-To: <mpt34xk9gza.fsf@arm.com> (Richard Sandiford's message of "Sun, 05 Nov 2023 18:45:29 +0000")
An entity isn't transparent in a block that requires a specific mode.
optimize_mode_switching took that into account for normal insns,
but didn't for the exit block. Later patches misbehaved because
of this.
In contrast, an entity was correctly marked as non-transparent
in the entry block, but the reasoning seemed a bit convoluted.
It also referred to a function that no longer exists.
Since KILL = ~TRANSP, the entity is by definition not transparent
in a block that defines the entity, so I think we can make it so
without comment.
Finally, the exit handling was nested in the entry handling,
but that doesn't seem necessary. A target could say that an
entity is undefined on entry but must be defined on return,
on a "be liberal in what you accept, be conservative in what
you do" principle.
gcc/
* mode-switching.cc (optimize_mode_switching): Mark the exit
block as nontransparent if it requires a specific mode.
Handle the entry and exit mode as sibling rather than nested
concepts. Remove outdated comment.
---
gcc/mode-switching.cc | 34 +++++++++++++++-------------------
1 file changed, 15 insertions(+), 19 deletions(-)
diff --git a/gcc/mode-switching.cc b/gcc/mode-switching.cc
index 03dd4c1ebe4..1145350ca26 100644
--- a/gcc/mode-switching.cc
+++ b/gcc/mode-switching.cc
@@ -650,34 +650,30 @@ optimize_mode_switching (void)
}
if (targetm.mode_switching.entry && targetm.mode_switching.exit)
{
- int mode = targetm.mode_switching.entry (e);
-
info[post_entry->index].mode_out =
info[post_entry->index].mode_in = no_mode;
- if (pre_exit)
- {
- info[pre_exit->index].mode_out =
- info[pre_exit->index].mode_in = no_mode;
- }
+ int mode = targetm.mode_switching.entry (e);
if (mode != no_mode)
{
- bb = post_entry;
-
- /* By always making this nontransparent, we save
- an extra check in make_preds_opaque. We also
- need this to avoid confusing pre_edge_lcm when
- antic is cleared but transp and comp are set. */
- bitmap_clear_bit (transp_all, bb->index);
-
/* Insert a fake computing definition of MODE into entry
blocks which compute no mode. This represents the mode on
entry. */
- info[bb->index].computing = mode;
+ info[post_entry->index].computing = mode;
+ bitmap_clear_bit (transp_all, post_entry->index);
+ }
- if (pre_exit)
- info[pre_exit->index].seginfo->mode =
- targetm.mode_switching.exit (e);
+ if (pre_exit)
+ {
+ info[pre_exit->index].mode_out =
+ info[pre_exit->index].mode_in = no_mode;
+
+ int mode = targetm.mode_switching.exit (e);
+ if (mode != no_mode)
+ {
+ info[pre_exit->index].seginfo->mode = mode;
+ bitmap_clear_bit (transp_all, pre_exit->index);
+ }
}
}
--
2.25.1
next prev parent reply other threads:[~2023-11-05 18:48 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-05 18:45 [PATCH 00/12] Tweaks and extensions to the mode-switching pass Richard Sandiford
2023-11-05 18:46 ` [PATCH 01/12] mode-switching: Tweak the macro/hook documentation Richard Sandiford
2023-11-07 0:10 ` Jeff Law
2023-11-05 18:46 ` [PATCH 02/12] mode-switching: Add note problem Richard Sandiford
2023-11-07 0:11 ` Jeff Law
2023-11-05 18:47 ` [PATCH 03/12] mode-switching: Avoid quadractic list operation Richard Sandiford
2023-11-07 0:47 ` Jeff Law
2023-11-05 18:47 ` [PATCH 04/12] mode-switching: Fix the mode passed to the emit hook Richard Sandiford
2023-11-07 0:51 ` Jeff Law
2023-11-05 18:47 ` [PATCH 05/12] mode-switching: Simplify recording of transparency Richard Sandiford
2023-11-07 0:52 ` Jeff Law
2023-11-05 18:48 ` Richard Sandiford [this message]
2023-11-07 1:01 ` [PATCH 06/12] mode-switching: Tweak entry/exit handling Jeff Law
2023-11-05 18:48 ` [PATCH 07/12] mode-switching: Allow targets to set the mode for EH handlers Richard Sandiford
2023-11-07 1:07 ` Jeff Law
2023-11-08 0:15 ` Richard Sandiford
2023-11-08 2:24 ` Jeff Law
2023-11-05 18:48 ` [PATCH 08/12] mode-switching: Pass set of live registers to the needed hook Richard Sandiford
2023-11-07 1:11 ` Jeff Law
2023-11-05 18:49 ` [PATCH 09/12] mode-switching: Pass the set of live registers to the after hook Richard Sandiford
2023-11-07 1:12 ` Jeff Law
2023-11-05 18:49 ` [PATCH 10/12] mode-switching: Use 1-based edge aux fields Richard Sandiford
2023-11-07 2:53 ` Jeff Law
2023-11-08 0:35 ` Richard Sandiford
2023-11-08 2:22 ` Jeff Law
2023-11-11 15:51 ` Richard Sandiford
2023-11-11 16:19 ` Jeff Law
2023-11-05 18:50 ` [PATCH 11/12] mode-switching: Add a target-configurable confluence operator Richard Sandiford
2023-11-07 3:04 ` Jeff Law
2023-11-11 15:54 ` Richard Sandiford
2023-11-11 16:19 ` Jeff Law
2023-11-11 17:29 ` Richard Sandiford
2023-11-05 18:50 ` [PATCH 12/12] mode-switching: Add a backprop hook Richard Sandiford
2023-11-10 1:18 ` Jeff Law
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=mpt4ji082ag.fsf@arm.com \
--to=richard.sandiford@arm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jlaw@ventanamicro.com \
/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).