public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] explow: Avoid unnecessary alignment operations
Date: Sun, 05 Nov 2023 18:33:12 +0000	[thread overview]
Message-ID: <mpta5rs9hjr.fsf@arm.com> (raw)

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


             reply	other threads:[~2023-11-05 18:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-05 18:33 Richard Sandiford [this message]
2023-11-06  7:17 ` 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=mpta5rs9hjr.fsf@arm.com \
    --to=richard.sandiford@arm.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).