From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2473 invoked by alias); 3 Oct 2011 22:30:29 -0000 Received: (qmail 2463 invoked by uid 22791); 3 Oct 2011 22:30:28 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-yx0-f175.google.com (HELO mail-yx0-f175.google.com) (209.85.213.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 03 Oct 2011 22:30:08 +0000 Received: by yxj17 with SMTP id 17so4684962yxj.20 for ; Mon, 03 Oct 2011 15:30:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.101.147.18 with SMTP id z18mr412830ann.129.1317681007670; Mon, 03 Oct 2011 15:30:07 -0700 (PDT) Received: by 10.100.153.19 with HTTP; Mon, 3 Oct 2011 15:30:07 -0700 (PDT) Date: Mon, 03 Oct 2011 22:30:00 -0000 Message-ID: Subject: Re: missing conditional propagation in cprop.c pass From: Steven Bosscher To: Jeff Law , "Amker.Cheng" Cc: Rahul Kharche , "Paulo J. Matos" , GCC Mailing List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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: 2011-10/txt/msg00024.txt.bz2 Hi, > Though conditional const information "r684 <- 0" is collected by > find_implicit_sets, the conditional information is recorded as local > information of bb 97, and it is not recorded in avout of bb 96, so not > in avin of bb 97 either. To have the set in avout of bb 96 would be wrong because the set is only available on the edge from bb 96 to bb 97, but not on the edge from bb 96 to bb 47. What should be done about this, is to add the implicit sets to AVIN of the block that the implicit set is recorded for. You have to do this after calling lcm.c's compute_available() because the normal "available expressions" problem in its basic block based form cannot handle implicit sets. I think something like the patch below (completely untested, of course ;-) will be necessary to fix this problem. If you file a PR with a test case, and assign it to me, I'll have a closer look and I'll see if I can come up with a proper patch. Ciao! Steven Index: cprop.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- cprop.c (revision 179480) +++ cprop.c (working copy) @@ -641,9 +641,33 @@ static void compute_cprop_data (void) { + basic_block bb; + compute_local_properties (cprop_absaltered, cprop_pavloc, &set_hash_tabl= e); compute_available (cprop_pavloc, cprop_absaltered, cprop_avout, cprop_avin); + + /* Merge implicit sets into CPROP_AVIN. Implicit sets are always + available at the head of the basic block they are recorded for. */ + FOR_EACH_BB (bb) + { + if (implicit_sets[bb->index] !=3D NULL_RTX) + { + rtx implicit_set =3D implicit_sets[bb->index]; + int regno =3D REGNO (SET_DEST (implicit_set)); + struct expr *set =3D lookup_set (regno, &set_hash_table); + + /* Find the set that is computed in BB. */ + while (set) + { + if (TEST_BIT (cprop_pavloc[bb->index], set->bitmap_index)) + break; + set =3D next_set (regno, set); + } + gcc_assert (set); + SET_BIT (cprop_avin[bb->index], set->bitmap_index); + } + } } =E2=99=80 /* Copy/constant propagation. */