public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/49444] IV-OPTs changes an unaligned loads into aligned loads incorrectly
Date: Fri, 16 Dec 2011 00:36:00 -0000	[thread overview]
Message-ID: <bug-49444-4-7eTiuwqdB5@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-49444-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49444

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-12-16 00:33:10 UTC ---
This is the patch which I ended up with:
Index: tree-ssa-loop-ivopts.c
===================================================================
--- tree-ssa-loop-ivopts.c    (revision 61449)
+++ tree-ssa-loop-ivopts.c    (revision 61858)
@@ -6066,6 +6066,7 @@ rewrite_use_address (struct ivopts_data
   tree base_hint = NULL_TREE;
   tree ref, iv;
   bool ok;
+  tree type;

   adjust_iv_update_pos (cand, use);
   ok = get_computation_aff (data->current_loop, use, cand, use->stmt, &aff);
@@ -6087,7 +6088,13 @@ rewrite_use_address (struct ivopts_data
     base_hint = var_at_stmt (data->current_loop, cand, use->stmt);

   iv = var_at_stmt (data->current_loop, cand, use->stmt);
-  ref = create_mem_ref (&bsi, TREE_TYPE (*use->op_p), &aff,
+  type = TREE_TYPE (*use->op_p);
+  if (TREE_CODE (*use->op_p) == COMPONENT_REF)
+    {
+      unsigned align = DECL_ALIGN (TREE_OPERAND (*use->op_p, 1));
+      type = build_aligned_type (type, align);
+    }
+  ref = create_mem_ref (&bsi, type, &aff,
             reference_alias_ptr_type (*use->op_p),
             iv, base_hint, data->speed);
   copy_ref_info (ref, *use->op_p);
--- CUT ---
I also implemented on mips the misalignedmove patterns too.


  parent reply	other threads:[~2011-12-16  0:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-16 19:45 [Bug tree-optimization/49444] New: " pinskia at gcc dot gnu.org
2011-06-16 20:09 ` [Bug tree-optimization/49444] " rguenth at gcc dot gnu.org
2011-06-16 20:16 ` pinskia at gcc dot gnu.org
2011-06-16 21:10 ` pinskia at gcc dot gnu.org
2011-06-17  9:06 ` rguenth at gcc dot gnu.org
2011-06-17 16:25 ` pinskia at gcc dot gnu.org
2011-12-16  0:36 ` pinskia at gcc dot gnu.org [this message]
2011-12-16  8:02 ` ebotcazou at gcc dot gnu.org
2014-09-03 10:11 ` amker.cheng at gmail dot com
2014-09-03 11:07 ` rguenth at gcc dot gnu.org
2014-09-03 12:27 ` pinskia at gcc dot gnu.org

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=bug-49444-4-7eTiuwqdB5@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).