public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: gcc-patches@gcc.gnu.org
Subject: Strip NOP_EXPR before building MEM
Date: Sun, 28 Aug 2016 17:59:00 -0000	[thread overview]
Message-ID: <20160828175912.GG11792@kam.mff.cuni.cz> (raw)

Hi,
I have noticed that ivopts build MEM_REF (NOP_EXPR (address))
where NOP_EXPR converts one pointer type to another.  Later it tries
to expand it that on strict alignment targets punt on determining
the alignment and winds expensive memory reference.

It seems to make no sense to have NOP_EXPR here, but in addition
I think we want to somehow preserve alignment from original MEM_REF?

Honza

	* tree-ssa-lop-ivopts.c (get_computation_cost_at):
	strip nops before building mem ref
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 62ba71b..bd92031 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -5058,7 +5058,10 @@ fallback:
     return infinite_cost;
 
   if (address_p)
-    comp = build_simple_mem_ref (comp);
+    {
+      STRIP_NOPS (comp);
+      comp = build_simple_mem_ref (comp);
+    }
 
   cost = comp_cost (computation_cost (comp, speed), 0);
 

             reply	other threads:[~2016-08-28 17:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-28 17:59 Jan Hubicka [this message]
2016-08-30 10:25 ` 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=20160828175912.GG11792@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --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).