From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30882 invoked by alias); 8 Sep 2009 10:25:02 -0000 Received: (qmail 30790 invoked by uid 22791); 8 Sep 2009 10:24:59 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 Sep 2009 10:24:51 +0000 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n88AOZnu025161; Tue, 8 Sep 2009 06:24:35 -0400 Received: from zebedee.pink (vpn2-9-81.ams2.redhat.com [10.36.9.81]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n88AOWZF004873; Tue, 8 Sep 2009 06:24:33 -0400 Message-ID: <4AA630E0.2040009@redhat.com> Date: Tue, 08 Sep 2009 10:25:00 -0000 From: Andrew Haley User-Agent: Thunderbird 2.0.0.17 (X11/20081009) MIME-Version: 1.0 To: Alex Turjan CC: gcc@gcc.gnu.org, rsandifor@codesourcery.com, zadeck@naturalbridge.com Subject: Re: question about DSE References: <969088.51632.qm@web62405.mail.re1.yahoo.com> In-Reply-To: <969088.51632.qm@web62405.mail.re1.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2009-09/txt/msg00158.txt.bz2 Alex Turjan wrote: > Dear all, > Im writing to you regarding the dead store elimination (dse) which runs after register allocation. Apparently dse removes wrongly the following store (present in bb2): > > (insn 374 47 52 2 test.c:107 (set (mem/c:SI (plus:PSI (reg/f:PSI 55 ptr15) > (const_int 96 [0x60])) [19 fac_iter+0 S4 A32]) > (reg/v:SI 16 r16 [orig:161 step109 ] [161])) 48 {si_indexed_store_incl_ra} (nil)) > > despite being consumed (in bb3) by the following 2 loads: > (insn 380 71 64 3 test.c:112 (set (reg:HI 1 r1) > (mem:HI (plus:PSI (reg/f:PSI 55 ptr15) > (const_int 96 [0x60])) [0 S2 A16])) 12 {load} (nil)) > > (insn 382 346 65 3 test.c:112 (set (reg:HI 5 r5) > (mem:HI (plus:PSI (reg/f:PSI 55 ptr15) > (const_int 98 [0x62])) [0 S2 A16])) 12 {load} (nil)) > > > Can anyone point what may be the problem? > > As you can see the store is SI while the loads are HI. While looking to the comments from dse.c I get to the following remark: > > " There are three cases where dse falls short: > a) Reload sometimes creates the slot for one mode of access, and > then inserts loads and/or stores for a smaller mode. " > > Does it mean that such cases are not treated properly by dse? > > I observed that if I run with the flag -fno-strict-aliasing the wrongly removed store is no longer removed and the code is runs correctly. > Im wondering does the dse after register allocation make use of type based alias analysis? Here's part of the comment in alias.c: /* The alias sets assigned to MEMs assist the back-end in determining which MEMs can alias which other MEMs. In general, two MEMs in different alias sets cannot alias each other ... There's a lot more information in the comments there. Andrew.