public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/48172] [4.5/4.6/4.7 Regression] incorrect vectorization of loop in GCC 4.5.* with -O3
Date: Thu, 12 May 2011 13:55:00 -0000	[thread overview]
Message-ID: <bug-48172-4-dgpSX5A02y@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-48172-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #12 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-12 12:46:10 UTC ---
Like this?

Index: gcc/tree-vect-loop-manip.c
===================================================================
--- gcc/tree-vect-loop-manip.c  (revision 173703)
+++ gcc/tree-vect-loop-manip.c  (working copy)
@@ -2353,23 +2353,19 @@ vect_create_cond_for_align_checks (loop_

    Input:
      DR: The data reference.
-     VECT_FACTOR: vectorization factor.
-     SCALAR_LOOP_NITERS: number of iterations.
+     LENGTH_FACTOR: segment length to consider.

    Return an expression whose value is the size of segment which will be
    accessed by DR.  */

 static tree
-vect_vfa_segment_size (struct data_reference *dr, int vect_factor,
+vect_vfa_segment_size (struct data_reference *dr, tree length_factor,
                       tree scalar_loop_niters)
 {
   tree segment_length;
   segment_length = size_binop (MULT_EXPR,
                               fold_convert (sizetype, DR_STEP (dr)),
-                              size_int (vect_factor));
-  segment_length = size_binop (MULT_EXPR,
-                              segment_length,
-                              fold_convert (sizetype, scalar_loop_niters));
+                              fold_convert (sizetype, length_factor));
   if (vect_supportable_dr_alignment (dr, false)
         == dr_explicit_realign_optimized)
     {
@@ -2465,10 +2461,12 @@ vect_create_cond_for_alias_checks (loop_
         vect_create_addr_base_for_vector_ref (stmt_b, cond_expr_stmt_list,
                                              NULL_TREE, loop);

-      segment_length_a = vect_vfa_segment_size (dr_a, vect_factor,
-                                               scalar_loop_iters);
-      segment_length_b = vect_vfa_segment_size (dr_b, vect_factor,
-                                               scalar_loop_iters);
+      if (!operand_equal_p (DR_STEP (dr_a), DR_STEP (dr_b), 0))
+       length_factor = scalar_loop_iters;
+      else
+       length_factor = size_int (vect_factor);
+      segment_length_a = vect_vfa_segment_size (dr_a, length_factor);
+      segment_length_b = vect_vfa_segment_size (dr_b, length_factor);

       if (vect_print_dump_info (REPORT_DR_DETAILS))
        {

I also think that the re-alignment adjustment needs to be multiplied
by DR_STEP (maybe we only support it for DR_STEP == 1 at the moment).


  parent reply	other threads:[~2011-05-12 13:54 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-17 20:15 [Bug tree-optimization/48172] New: " geir at cray dot com
2011-03-18  9:32 ` [Bug tree-optimization/48172] [4.5/4.6/4.7 Regression] " rguenth at gcc dot gnu.org
2011-03-18  9:51 ` rguenth at gcc dot gnu.org
2011-03-18 10:05 ` rguenth at gcc dot gnu.org
2011-03-18 12:28 ` rguenth at gcc dot gnu.org
2011-03-19 17:35 ` irar at il dot ibm.com
2011-04-08  0:16 ` xunxun1982 at gmail dot com
2011-04-10 10:43 ` rguenth at gcc dot gnu.org
2011-04-28 15:22 ` rguenth at gcc dot gnu.org
2011-05-12 11:37 ` rguenth at gcc dot gnu.org
2011-05-12 12:46 ` irar at il dot ibm.com
2011-05-12 13:44 ` rguenth at gcc dot gnu.org
2011-05-12 13:55 ` rguenth at gcc dot gnu.org [this message]
2011-05-12 14:05 ` rguenth at gcc dot gnu.org
2011-05-12 14:06 ` irar at il dot ibm.com
2011-05-13  8:52 ` rguenth at gcc dot gnu.org
2011-05-13  9:19 ` [Bug tree-optimization/48172] [4.5/4.6 " rguenth at gcc dot gnu.org
2011-05-18 13:57 ` rguenth at gcc dot gnu.org
2011-07-19  0:57 ` [Bug tree-optimization/48172] [4.5 " cnstar9988 at gmail dot com
2012-01-03 13:08 ` rguenth at gcc dot gnu.org
2012-01-03 13:09 ` rguenth 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-48172-4-dgpSX5A02y@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).