From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32121 invoked by alias); 14 Jun 2011 10:39:15 -0000 Received: (qmail 32111 invoked by uid 22791); 14 Jun 2011 10:39:14 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,TW_TM X-Spam-Check-By: sourceware.org Received: from mail-px0-f176.google.com (HELO mail-px0-f176.google.com) (209.85.212.176) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 14 Jun 2011 10:38:58 +0000 Received: by pxi11 with SMTP id 11so2932854pxi.21 for ; Tue, 14 Jun 2011 03:38:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.143.61.12 with SMTP id o12mr1073564wfk.36.1308047938169; Tue, 14 Jun 2011 03:38:58 -0700 (PDT) Received: by 10.143.93.4 with HTTP; Tue, 14 Jun 2011 03:38:58 -0700 (PDT) In-Reply-To: References: Date: Tue, 14 Jun 2011 11:14:00 -0000 Message-ID: Subject: Re: [patch] Don't insert pattern statements into the code (was Fix PR tree-optimization/49318) From: Ira Rosen To: Richard Guenther Cc: gcc-patches@gcc.gnu.org, Patch Tracking Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-06/txt/msg01033.txt.bz2 On 14 June 2011 13:02, Richard Guenther wrote: > On Mon, Jun 13, 2011 at 2:43 PM, Ira Rosen wrote: >> On 10 June 2011 12:14, Richard Guenther wro= te: >>> In the end I think we should not generate the pattern stmt during >>> pattern matching but only mark the relevant statements with a >>> pattern kind. =A0Say, for each pattern we have a "main" statement >>> that has related stmts belonging to the pattern that define uses >>> of the "main" statement - mark those to refer to that "main" statement. >>> For that "main" statement simply record an enum value, like, >>> widening_mult. =A0Then only at vectorized statement >>> generation time actually generate the vectorized form of the >>> pattern statement. >> >> I ended up with the following: during pattern detection a new scalar >> pattern statement is created but not inserted into the code, it is >> only recorded as a related statement of the last statement in the >> detected pattern. Every time the last statement is being >> analyzed/transformed, we switch to the pattern statement instead. It >> is much more difficult just to mark the last stmt with an enum value, >> since we have to retrieve the relevant operands every time. >> >> I am not sure if we need to free the pattern stmt at the end. >> >> Bootstrapped and now testing on powerpc64-suse-linux (tested >> vectorizer testsuite on powerpc64-suse-linux and x86_64-suse-linux. >> >> What do you think? > > =A0 /* Mark the stmts that are involved in the pattern. */ > - =A0gsi_insert_before (&si, pattern_stmt, GSI_SAME_STMT); > =A0 set_vinfo_for_stmt (pattern_stmt, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0new_stmt_vec_info (pattern_stm= t, loop_vinfo, NULL)); > + =A0gimple_set_bb (pattern_stmt, gimple_bb (stmt)); > > do you really need this? Yes, there are a lot of uses of gimple_bb (stmt). Otherwise, we'd have to check there that bb exists (or that this is not a pattern stmt) and use the bb of the original statement if not. > Otherwise it looks reasonable. =A0Btw, > we can probably remove the simple DCE done in > slpeel_tree_peel_loop_to_edge (remove_dead_stmts_from_loop) > with this patch. I'll try that. Thanks, Ira > > Thanks, > Richard. > >> Thanks, >> Ira >> >> ChangeLog: >> >> =A0 =A0 * tree-vect-loop.c (vect_determine_vectorization_factor): Don't >> =A0 =A0 remove irrelevant pattern statements. =A0For irrelevant statemen= ts >> =A0 =A0 check if it is the last statement of a detected pattern, use >> =A0 =A0 corresponding pattern statement instead. >> =A0 =A0 (destroy_loop_vec_info): No need to remove pattern statements, >> =A0 =A0 only free stmt_vec_info. >> =A0 =A0 (vect_transform_loop): For irrelevant statements check if it is >> =A0 =A0 the last statement of a detected pattern, use corresponding >> =A0 =A0 pattern statement instead. >> =A0 =A0 * tree-vect-patterns.c (vect_pattern_recog_1): Don't insert >> =A0 =A0 pattern statements. =A0Set basic block for the new statement. >> =A0 =A0 (vect_pattern_recog): Update documentation. >> =A0 =A0 * tree-vect-stmts.c (vect_mark_stmts_to_be_vectorized): Scan >> =A0 =A0 operands of pattern statements. >> =A0 =A0 (vectorizable_call): Fix printing. =A0In case of a pattern state= ment >> =A0 =A0 use the lhs of the original statement when creating a dummy >> =A0 =A0 statement to replace the original call. >> =A0 =A0 (vect_analyze_stmt): For irrelevant statements check if it is >> =A0 =A0 the last statement of a detected pattern, use corresponding >> =A0 =A0 pattern statement instead. >> =A0 =A0 * tree-vect-slp.c (vect_schedule_slp_instance): For pattern >> =A0 =A0 statements use gsi of the original statement. >> >