This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] (4.1 projects, stage 1.1) vectorizer preserve loop-closed-ssa-form





Here is item 1.2 from the autovectorization enhancements list for 4.1.

This patch lets us remove the calls to rewrite_into_loop_closed from the
vectorizer.
The part that doesn't preserve loop-closed-form in the vectorizer is the
loop-peeling functionality. The function that is responsible for that -
'slpeel_update_phi_nodes_for_guard' - is modified to also insert the
required loop-closed phis where necessary. Currently this function operates
in two different modes, controlled by the boolean argument "entry_phis":
mode 1: updating phis for a guard that controls whether we enter or skip
LOOP, where LOOP is a prolog_loop, and the new phis created in NEW_MERGE_BB
are for variables that have phis in the loop header.
mode 2: updating phis for a guard that controls whether we enter or skip
LOOP, where LOOP is an epilog_loop, and the new phis created in
NEW_MERGE_BB are for variables that have phis in the loop exit.
The new handling of loop-closed-form phis introduces even more differences
between these two modes, which makes the code less readable. I therefore
split 'slpeel_update_phi_nodes_for_guard' into two separate function, one
for each mode - 'slpeel_update_phi_nodes_for_guard1', and
'slpeel_update_phi_nodes_for_guard2'.
The first part in each of these functions:
/** 1. Handle new-merge-point phis  **/
remains largely the same as before.
The new parts are:
/** 2. Handle loop-closed-ssa-form phis  **/
/** 3. Handle loop-closed-ssa-form phis for first loop  **/

This patch depends on:
[item 1.1] Incrementally preserve ssa form when vectorizing (Keith).

More precisely, the bit that depends on Keith's patch is:

*************** vectorize_loops (struct loops *loops)
*** 1616,1622 ****
        loop->aux = NULL;
      }

!   rewrite_into_ssa (false);
!   rewrite_into_loop_closed_ssa (NULL); /* FORNOW */
!   bitmap_clear (vars_to_rename);
  }
--- 1896,1902 ----
        loop->aux = NULL;
      }

! #ifdef ENABLE_CHECKING
!   verify_loop_closed_ssa ();
! #endif
  }

Keith's patch lets us remove the call to rewrite_into_ssa;
This patch lets us remove the call to rewrite_into_loop_closed_ssa on top
of that.

Attached is the loop-closed patch (4.1vect_patch.1.2.dn), and the combined
patch that includes the necessary bits from Keith's patch (4.1
vect_patch.1.2.all).
I bootstrapped the combined patch (with vectorization enabled) and tested
on powerpc-darwin and
i686-pc-linux-gnu.

ok for mainline (once Keith's patch is committed)?

thanks,

dorit

Changelog:

        * tree-vectorizer.c (slpeel_update_phi_nodes_for_guard): Removed.
        (slpeel_update_phi_nodes_for_guard1): New function.
        (slpeel_update_phi_nodes_for_guard2): New function.
        (slpeel_tree_peel_loop_to_edge): Call above new functions instead
of
        slpeel_update_phi_nodes_for_guard.
        (vectorize_loops): Remove call to loop_closed_rewrite.
        * tree-vect-transform.c (vect_update_ivs_after_vectorizer): Remove
assertion.

patch:

(See attached file: 4.1vect_patch.1.2.dn)(See attached file: 4.1
vect_patch.1.2.all)

Attachment: 4.1vect_patch.1.2.dn
Description: Binary data

Attachment: 4.1vect_patch.1.2.all
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]