From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2608 invoked by alias); 11 Feb 2015 11:20:18 -0000 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 Received: (qmail 2592 invoked by uid 89); 11 Feb 2015 11:20:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_FROM_URIBL_PCCC,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-qg0-f52.google.com Received: from mail-qg0-f52.google.com (HELO mail-qg0-f52.google.com) (209.85.192.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 11 Feb 2015 11:20:16 +0000 Received: by mail-qg0-f52.google.com with SMTP id h3so1981849qgf.11 for ; Wed, 11 Feb 2015 03:20:14 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.229.68.202 with SMTP id w10mr12165303qci.13.1423653614710; Wed, 11 Feb 2015 03:20:14 -0800 (PST) Received: by 10.140.102.170 with HTTP; Wed, 11 Feb 2015 03:20:14 -0800 (PST) In-Reply-To: <5494426A.9010209@naturalbridge.com> References: <54803EBE.2060607@arm.com> <5480B6D6.2020201@arm.com> <548EFE0D.1070808@arm.com> <548EFE55.6090901@arm.com> <54930811.1020003@arm.com> <20141218220908.GA20720@gate.crashing.org> <5494426A.9010209@naturalbridge.com> Date: Wed, 11 Feb 2015 11:20:00 -0000 Message-ID: Subject: Re: [PATCH] PR 62173, re-shuffle insns for RTL loop invariant hoisting From: Jiong Wang To: Kenneth Zadeck Cc: Richard Biener , "Bin.Cheng" , Segher Boessenkool , Jiong Wang , "gcc-patches@gcc.gnu.org" Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-02/txt/msg00692.txt.bz2 2014-12-19 15:21 GMT+00:00 Kenneth Zadeck : > > however, since i am a nice person .... > > loop-invariant solves the DF_UD_CHAIN which builds a data structure that > connects each use with all of the defs that reach it. I believe that this > is the opposite of what you want here. > > if you really need this, you need to also turn on the DF_DU_CHAIN which > builds the opposite structure. Both structures can be space hogs, but > they are both turned on in other places in the compiler so it is unlikely to > be an issue. Exactly, Thanks, Kenneth. This approach works from my experiment and look much better than previous REG_NOTE approach. while it do have one problem. We need the UD/DU chain built before we do insn re-shuffling. While after re-shuffling, UD chain needs update, otherwise, the later "check_dependecies" in find_invariant_insn may fail. although we have re-shuffle instruction 1 into 2, the later check still using old UD info, thus decide instruction 2 is not iv. 1: regA <- vfp + regB 2: regA <- vfp + const my current fix is to insert those re-shuffled insn into a table named "vfp_const_iv", then skip those dependencies check for them as they don't have any dependencies. > > > >> >>>>> LOG_LINKs have nothing to do with single use; they point from the >>>>> _first_ >>>>> use to its corresponding def. >>>>> >>>>> You might want to look at what fwprop does instead. >>>> >>>> Pass rtl fwprop uses df information in single-definition way, it >>>> doesn't really take into consideration if register is a single use. >>>> This often corrupts other optimizations like post-increment and >>>> load/store pair. For example: >>>> >>>> add r2, r1, r0 >>>> ldr rx, [r2] >>>> add r2, r2, #4 >>>> is transformed into below form: >>>> add r2, r1, r0 >>>> ldr rx, [r1, r0] >>>> add r2, r2, #4 >>>> >>>> As a result, post-increment opportunity is corrupted, also definition >>>> of r2 can't be deleted because it's not single use. >>>> >>>> Thanks, >>>> bin >>> >>> thanks for all these suggestion. >>> >>> Have look at the LOG_LINK build function, a simple reverse scan, while >>> needs to allocate big map array for all pseudo regs. Haven't looked at >>> similar code in fwprop, >>> >>> actually, when found the first matched insn pattern, I just want to >>> scan several insns next, then abort quickly if nothing meet >>> requirement. there is no need to build full single-use information. >>> >>> still can anyone confirm that it is safe to re-use REG_DEAD info there >>> without calling df_note_add_problem and df_analysis first? or I am >>> using those info passed down from the previous pass which calculated >>> these info and maybe broken? >> >> It's not safe to use REG_DEAD info without re-computing it. > > not sure that reg_dead is the right answer even if you did re-compute it. > I believe you can have two parallel uses (on both sides of an if-then-else) > for a single def (above the if then else) and have two REG_DEAD notes. > >> Richard. > >