public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dorit at il dot ibm dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/24378] [4.1/4.2 Regression] gcc.dg/vect/pr24300.c (test for excess errors) fails
Date: Wed, 07 Dec 2005 20:49:00 -0000	[thread overview]
Message-ID: <20051207204908.9895.qmail@sourceware.org> (raw)
In-Reply-To: <bug-24378-230@http.gcc.gnu.org/bugzilla/>



------- Comment #7 from dorit at il dot ibm dot com  2005-12-07 20:49 -------
(In reply to comment #6)
Can you test the attached patch?
Unfortunrately it's relative to autovect-branch, but hopefully it would easily
apply to mainline/4.1. Unbootstrapped, hardly tested...


Index: tree-vect-transform.c
===================================================================
--- tree-vect-transform.c       (revision 108060)
+++ tree-vect-transform.c       (working copy)
@@ -5052,12 +5069,44 @@
       tree cond_expr_stmt_list = NULL_TREE;
       basic_block condition_bb;
       block_stmt_iterator cond_exp_bsi;
+      basic_block merge_bb;
+      basic_block new_exit_bb;
+      edge new_exit_e, e;
+      tree orig_phi, new_phi, arg;

       cond_expr = vect_create_cond_for_align_checks (loop_vinfo,
                                                      &cond_expr_stmt_list);
       initialize_original_copy_tables ();
       nloop = loop_version (loops, loop, cond_expr, &condition_bb, true);
       free_original_copy_tables();
+
+      /** Loop versioning violets an assumption we try to maintain during 
+        vectorization - that the loop exit block has a single predecessor.
+        After versioning, the exit block of both loop versions is the same
+        basic block (i.e. it has two predecessors). Just in order to simplify
+        following transformations in the vectorizer, we fix this situation
+        here by adding a new (empty) block on the exit-edge of the loop,
+        with the proper loop-exit phis to maintain loop-closed-form.  **/
+      
+      merge_bb = loop->single_exit->dest;
+      gcc_assert (EDGE_COUNT (merge_bb->preds) == 2);
+      new_exit_bb = split_edge (loop->single_exit);
+      add_bb_to_loop (new_exit_bb, loop->outer);
+      new_exit_e = loop->single_exit;
+      e = EDGE_SUCC (new_exit_bb, 0);
+
+      for (orig_phi = phi_nodes (merge_bb); orig_phi; 
+          orig_phi = PHI_CHAIN (orig_phi))
+       {
+          new_phi = create_phi_node (SSA_NAME_VAR (PHI_RESULT (orig_phi)),
+                                    new_exit_bb);
+          arg = PHI_ARG_DEF_FROM_EDGE (orig_phi, e);
+          add_phi_arg (new_phi, arg, new_exit_e);
+         SET_PHI_ARG_DEF (orig_phi, e->dest_idx, PHI_RESULT (new_phi));
+       } 
+
+      /** end loop-exit-fixes after versioning  **/
+
       update_ssa (TODO_update_ssa);
       cond_exp_bsi = bsi_last (condition_bb);
       bsi_insert_before (&cond_exp_bsi, cond_expr_stmt_list, BSI_SAME_STMT);


-- 


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


  parent reply	other threads:[~2005-12-07 20:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-14 23:53 [Bug target/24378] New: " jsm28 at gcc dot gnu dot org
2005-10-16  5:47 ` [Bug target/24378] " phython at gcc dot gnu dot org
2005-11-20 22:18 ` [Bug target/24378] [4.1 Regression] " phython at gcc dot gnu dot org
2005-12-05  8:52 ` ebotcazou at gcc dot gnu dot org
2005-12-06  9:22 ` [Bug target/24378] [4.1/4.2 " ebotcazou at gcc dot gnu dot org
2005-12-07 16:35 ` dorit at il dot ibm dot com
2005-12-07 18:18 ` ebotcazou at gcc dot gnu dot org
2005-12-07 20:49 ` dorit at il dot ibm dot com [this message]
2005-12-08  8:33 ` ebotcazou at gcc dot gnu dot org
2005-12-14 15:38 ` dorit at il dot ibm dot com
2005-12-14 16:38 ` [Bug tree-optimization/24378] " ebotcazou at gcc dot gnu dot org
2005-12-18  8:46 ` dorit at gcc dot gnu dot org
2005-12-18 11:20 ` dorit at gcc dot gnu dot org
2005-12-22 13:05 ` ebotcazou at gcc dot gnu dot 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=20051207204908.9895.qmail@sourceware.org \
    --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).