From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 62196 invoked by alias); 13 Sep 2019 10:44:48 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 62175 invoked by uid 89); 13 Sep 2019 10:44:45 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=stefan, Stefan, H*UA:Outlook, H*x:Outlook X-HELO: franke.ms Received: from serveronline.org (HELO franke.ms) (78.46.86.77) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 13 Sep 2019 10:44:43 +0000 Received: from Thinky (11.red-79-156-181.staticip.rima-tde.net [79.156.181.11]) by serveronline.org (BEJY V1.6.12-SNAPSHOT (c) 2000-2019 by BebboSoft, Stefan "Bebbo" Franke, all rights reserved) with SMTP id 16d2a399625715ac35f7f56d348 from stefan@franke.ms for gcc-help@gcc.gnu.org; Fri, 13 Sep 2019 11:44:40 +0100 From: To: "'Richard Sandiford'" Cc: References: <01e301d56a0f$f7b9cba0$e72d62e0$@franke.ms> In-Reply-To: Subject: AW: new ira optimization - adding a loop to ira Date: Fri, 13 Sep 2019 10:44:00 -0000 Message-ID: <022801d56a20$3edbaf20$bc930d60$@franke.ms> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-SW-Source: 2019-09/txt/msg00046.txt.bz2 > -----Urspr=FCngliche Nachricht----- > Von: Richard Sandiford > Gesendet: Freitag, 13. September 2019 12:16 > An: stefan@franke.ms > Cc: gcc-help@gcc.gnu.org > Betreff: Re: new ira optimization - adding a loop to ira >=20 > writes: > > I'm working on a new optimization to get rid of spilled tmp variables (e.g. > > introduced by pre) to use the source mem ref instead of a stack slot. > > > > To do this, I added a loop into ira.c:ira() > > > > init_prune_stack_vars (); > > do > > { > > #ifndef IRA_NO_OBSTACK > > gcc_obstack_init (&ira_obstack); > > #endif > > bitmap_obstack_initialize (&ira_bitmap_obstack); > > > > ... > > > > ira_color (); > > > > } > > while (flag_prune_stack_vars && prune_stack_vars ()); > > > > To get it work, the prune_stack_vars function resets a couple of data. > > This is mostly working - but on some source files, it fails due to > > invalid reg_equivs. > > Since this also happens, if the optimizer does nothing and just loops once. > > > > Currently I'm calling this, before looping again > > > > regstat_free_n_sets_and_refs (); > > regstat_free_ri (); > > loop_optimizer_finalize (); > > free_dominance_info (CDI_DOMINATORS); > > > > Any hint, what I'm missing to reset? >=20 > I can't see anything obviously missing. What kind of failure do you see? E.g. > do you get an internal compiler error or does the compiler generate > incorrect code? >=20 > Do you see the failure on an in-tree test case? FWIW, I just tried looping like > this locally and didn't see any failures for the tests I tried. But I was obviously > testing without the new optimisation, and so each loop iteration should just > repeat what the previous one did. >=20 > Not related to the failure, but: do you do anything with the obstacks when > looping again? Including the initialisations in the loop as above would > introduce a memory leak if you don't do anything to free the contents. > It'd probably be better to initialise outside the loop unless you're really > confident that the no data is carried across iterations. >=20 > Thanks, > Richard Thanks f=FCr the ira_obstack hint - I will take care of this, once the loop mode is working - maybe I can start looping later or I'll free the memory. In reload: push_reload(...) this raises an error: gcc_assert (regno < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >=3D 0 || reg_equiv_constant (regno) =3D=3D NULL_RTX); I already know that it's reg_equiv_constant and that this reg_equiv_constant is also set in the unpatched code. So I am looking why these additional reloads occur. There are additional reloads if I enable the loop, interestingly for uid like 2, 3, 4 ... Thanks, Stefan