* [PATCH] explow: Avoid unnecessary alignment operations
@ 2023-11-05 18:33 Richard Sandiford
2023-11-06 7:17 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Richard Sandiford @ 2023-11-05 18:33 UTC (permalink / raw)
To: gcc-patches
align_dynamic_address would output alignment operations even
for a required alignment of 1 byte.
Tested on aarch64-linux-gnu & x86_64-linux-gnu. OK to install?
Richard
gcc/
* explow.cc (align_dynamic_address): Do nothing if the required
alignment is a byte.
---
gcc/explow.cc | 3 +++
1 file changed, 3 insertions(+)
diff --git a/gcc/explow.cc b/gcc/explow.cc
index aa64d5e906c..0be6d2629c9 100644
--- a/gcc/explow.cc
+++ b/gcc/explow.cc
@@ -1201,6 +1201,9 @@ record_new_stack_level (void)
rtx
align_dynamic_address (rtx target, unsigned required_align)
{
+ if (required_align == BITS_PER_UNIT)
+ return target;
+
/* CEIL_DIV_EXPR needs to worry about the addition overflowing,
but we know it can't. So add ourselves and then do
TRUNC_DIV_EXPR. */
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] explow: Avoid unnecessary alignment operations
2023-11-05 18:33 [PATCH] explow: Avoid unnecessary alignment operations Richard Sandiford
@ 2023-11-06 7:17 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2023-11-06 7:17 UTC (permalink / raw)
To: gcc-patches, richard.sandiford
On Sun, Nov 5, 2023 at 7:33 PM Richard Sandiford
<richard.sandiford@arm.com> wrote:
>
> align_dynamic_address would output alignment operations even
> for a required alignment of 1 byte.
>
> Tested on aarch64-linux-gnu & x86_64-linux-gnu. OK to install?
OK
> Richard
>
>
> gcc/
> * explow.cc (align_dynamic_address): Do nothing if the required
> alignment is a byte.
> ---
> gcc/explow.cc | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/gcc/explow.cc b/gcc/explow.cc
> index aa64d5e906c..0be6d2629c9 100644
> --- a/gcc/explow.cc
> +++ b/gcc/explow.cc
> @@ -1201,6 +1201,9 @@ record_new_stack_level (void)
> rtx
> align_dynamic_address (rtx target, unsigned required_align)
> {
> + if (required_align == BITS_PER_UNIT)
> + return target;
> +
> /* CEIL_DIV_EXPR needs to worry about the addition overflowing,
> but we know it can't. So add ourselves and then do
> TRUNC_DIV_EXPR. */
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-11-06 7:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-05 18:33 [PATCH] explow: Avoid unnecessary alignment operations Richard Sandiford
2023-11-06 7:17 ` Richard Biener
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).