Message ID | ZDgHd4qtTuRk3r7H@tucnak |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7DBE23858404 for <patchwork@sourceware.org>; Thu, 13 Apr 2023 13:46:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7DBE23858404 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681393572; bh=0ekTp3qScEiHTUqqzuLIGI4farSVqggDgUWQiUNEiPs=; h=Date:To:Cc:Subject:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=STm2fQCQk5UpnNZ2LbnHAB14ygqHdipqkBv1WQd3Z+SIsJvWeyRItbOYAZxPNdIdq Kyczafa4j9z9cb8sLSq3SQP1qtaEGFpJczVcv4h4+8LepRtvlGZ0NxkeyFTKCnF51p CCSTugZs3Nk6rdiBQ89GtjpVd4dG1lp7ZalSusHo= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 470D73858D32 for <gcc-patches@gcc.gnu.org>; Thu, 13 Apr 2023 13:45:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 470D73858D32 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-541-PI06nY75MXeud1jU_GY6YA-1; Thu, 13 Apr 2023 09:45:39 -0400 X-MC-Unique: PI06nY75MXeud1jU_GY6YA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 07DE788F46B; Thu, 13 Apr 2023 13:45:39 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A4896404DC40; Thu, 13 Apr 2023 13:45:38 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 33DDjZML3913727 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 13 Apr 2023 15:45:35 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 33DDjSWQ3913724; Thu, 13 Apr 2023 15:45:28 +0200 Date: Thu, 13 Apr 2023 15:45:27 +0200 To: Jeff Law <jeffreyalaw@gmail.com> Cc: Segher Boessenkool <segher@kernel.crashing.org>, Eric Botcazou <botcazou@adacore.com>, gcc-patches@gcc.gnu.org, Richard Biener <rguenther@suse.de>, Richard Sandiford <richard.sandiford@arm.com> Subject: [PATCH] loop-iv: Fix up bounds computation Message-ID: <ZDgHd4qtTuRk3r7H@tucnak> References: <3412470.QJadu78ljV@fomalhaut> <8d3c3861-c291-e762-a2a8-0b520f39a7e3@gmail.com> <ZDO2g7hYvMCJlIn4@tucnak> <965831db-ac9e-cc5e-3459-08b6b70fd577@gmail.com> <ZDZN5sukXDLkdZjW@tucnak> <ZDaBpPyA/XiPOvjw@tucnak> <ZDbjI34T20ewQ2qs@tucnak> <0760f780-ba7d-3476-1d9a-7b5f3063d63b@gmail.com> <20230413105755.GD19790@gate.crashing.org> <811f7d5a-bb26-b9d1-ed09-7d404b9c7c7f@gmail.com> MIME-Version: 1.0 In-Reply-To: <811f7d5a-bb26-b9d1-ed09-7d404b9c7c7f@gmail.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Jakub Jelinek via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Jakub Jelinek <jakub@redhat.com> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
loop-iv: Fix up bounds computation
|
|
Commit Message
Jakub Jelinek
April 13, 2023, 1:45 p.m. UTC
On Thu, Apr 13, 2023 at 06:35:07AM -0600, Jeff Law wrote: > Bootstrap was successful with v3, but there's hundreds of testsuite failures > due to the simplify-rtx hunk. compile/20070520-1.c for example when > compiled with: -O3 -funroll-loops -march=rv64gc -mabi=lp64d > > Thursdays are my hell day. It's unlikely I'd be able to look at this at all > today. So, seems to me this is because loop-iv.cc asks for invalid RTL to be simplified, it calls simplify_gen_binary (AND, SImode, (subreg:SI (plus:DI (reg:DI 289 [ ivtmp_312 ]) (const_int 4294967295 [0xffffffff])) 0), (const_int 4294967295 [0xffffffff])) but 0xffffffff is not valid SImode CONST_INT, and unlike previously we no longer on WORD_REGISTER_OPERATIONS targets which have DImode word_mode optimize that into the op0, so the invalid constant is emitted into the IL and checking fails. The following patch fixes that (and we optimize that & -1 away even earlier with that). Could you please just quickly try to apply this patch, make in the stage3 directory followed by make check-gcc RUNTESTFLAGS="... compile.exp='20070520-1.c ...'" (with all tests that regressed previously), whether this is the only spot or whether we need to fix some other place too? 2023-04-13 Jakub Jelinek <jakub@redhat.com> * loop-iv.cc (iv_number_of_iterations): Use gen_int_mode instead of GEN_INT. Jakub
Comments
On 4/13/23 07:45, Jakub Jelinek wrote: > On Thu, Apr 13, 2023 at 06:35:07AM -0600, Jeff Law wrote: >> Bootstrap was successful with v3, but there's hundreds of testsuite failures >> due to the simplify-rtx hunk. compile/20070520-1.c for example when >> compiled with: -O3 -funroll-loops -march=rv64gc -mabi=lp64d >> >> Thursdays are my hell day. It's unlikely I'd be able to look at this at all >> today. > > So, seems to me this is because loop-iv.cc asks for invalid RTL to be > simplified, it calls simplify_gen_binary (AND, SImode, > (subreg:SI (plus:DI (reg:DI 289 [ ivtmp_312 ]) > (const_int 4294967295 [0xffffffff])) 0), > (const_int 4294967295 [0xffffffff])) > but 0xffffffff is not valid SImode CONST_INT, and unlike previously > we no longer on WORD_REGISTER_OPERATIONS targets which have DImode > word_mode optimize that into the op0, so the invalid constant is emitted > into the IL and checking fails. > > The following patch fixes that (and we optimize that & -1 away even earlier > with that). > > Could you please just quickly try to apply this patch, make in the stage3 > directory followed by > make check-gcc RUNTESTFLAGS="... compile.exp='20070520-1.c ...'" > (with all tests that regressed previously), whether this is the only spot > or whether we need to fix some other place too? > > 2023-04-13 Jakub Jelinek <jakub@redhat.com> > > * loop-iv.cc (iv_number_of_iterations): Use gen_int_mode instead > of GEN_INT. I'll try to apply this and do just an incremental build & test to see if it resolves all the regressions. It should complete while I'm in my meeting hell. jeff
On 4/13/23 07:45, Jakub Jelinek wrote: > On Thu, Apr 13, 2023 at 06:35:07AM -0600, Jeff Law wrote: >> Bootstrap was successful with v3, but there's hundreds of testsuite failures >> due to the simplify-rtx hunk. compile/20070520-1.c for example when >> compiled with: -O3 -funroll-loops -march=rv64gc -mabi=lp64d >> >> Thursdays are my hell day. It's unlikely I'd be able to look at this at all >> today. > > So, seems to me this is because loop-iv.cc asks for invalid RTL to be > simplified, it calls simplify_gen_binary (AND, SImode, > (subreg:SI (plus:DI (reg:DI 289 [ ivtmp_312 ]) > (const_int 4294967295 [0xffffffff])) 0), > (const_int 4294967295 [0xffffffff])) > but 0xffffffff is not valid SImode CONST_INT, and unlike previously > we no longer on WORD_REGISTER_OPERATIONS targets which have DImode > word_mode optimize that into the op0, so the invalid constant is emitted > into the IL and checking fails. > > The following patch fixes that (and we optimize that & -1 away even earlier > with that). > > Could you please just quickly try to apply this patch, make in the stage3 > directory followed by > make check-gcc RUNTESTFLAGS="... compile.exp='20070520-1.c ...'" > (with all tests that regressed previously), whether this is the only spot > or whether we need to fix some other place too? > > 2023-04-13 Jakub Jelinek <jakub@redhat.com> > > * loop-iv.cc (iv_number_of_iterations): Use gen_int_mode instead > of GEN_INT. That fixes all the regressions and looks OK to me. jeff
--- gcc/loop-iv.cc.jj 2023-01-02 09:32:23.000000000 +0100 +++ gcc/loop-iv.cc 2023-04-13 15:34:11.939045804 +0200 @@ -2617,7 +2617,7 @@ iv_number_of_iterations (class loop *loo d *= 2; size--; } - bound = GEN_INT (((uint64_t) 1 << (size - 1 ) << 1) - 1); + bound = gen_int_mode (((uint64_t) 1 << (size - 1) << 1) - 1, mode); tmp1 = lowpart_subreg (mode, iv1.base, comp_mode); tmp = simplify_gen_binary (UMOD, mode, tmp1, gen_int_mode (d, mode));