From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by sourceware.org (Postfix) with ESMTP id F0E34385DC09 for ; Wed, 1 Apr 2020 13:47:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F0E34385DC09 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-459-54ycEW1tNkulNW40CNDB0Q-1; Wed, 01 Apr 2020 09:47:15 -0400 X-MC-Unique: 54ycEW1tNkulNW40CNDB0Q-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D39FCDB20; Wed, 1 Apr 2020 13:47:13 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-113-52.ams2.redhat.com [10.36.113.52]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3BFDA5C1D5; Wed, 1 Apr 2020 13:47:13 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id 031DlAvn026180; Wed, 1 Apr 2020 15:47:11 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id 031Dl9Mr026169; Wed, 1 Apr 2020 15:47:09 +0200 Date: Wed, 1 Apr 2020 15:47:09 +0200 From: Jakub Jelinek To: Richard Biener Cc: gcc-patches@gcc.gnu.org, "Joseph S. Myers" Subject: Re: [PATCH][RFC] c/94392 - only enable -ffinite-loops for C++ Message-ID: <20200401134709.GK2212@tucnak> Reply-To: Jakub Jelinek References: MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Spam-Status: No, score=-15.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Apr 2020 13:47:18 -0000 On Wed, Apr 01, 2020 at 03:36:30PM +0200, Richard Biener wrote: > @@ -512,7 +512,10 @@ can_inline_edge_by_limits_p (struct cgraph_edge *e, = bool report, > =09 /* When devirtualization is disabled for callee, it is not safe > =09=09 to inline it as we possibly mangled the type info. > =09=09 Allow early inlining of always inlines. */ > -=09 || (!early && check_maybe_down (flag_devirtualize))) > +=09 || (!early && check_maybe_down (flag_devirtualize)) > +=09 /* It's not safe to inline a function where loops maybe > +=09=09 infinite into a function where we assume the reverse. */ > +=09 || check_maybe_down (flag_finite_loops)) > =09{ > =09 e->inline_failed =3D CIF_OPTIMIZATION_MISMATCH; > =09 inlinable =3D false; Couldn't the above care only if the function has any loops? Otherwise, won't it prevent cross-language LTO inlining too much? Or instead of disabling inlining arrange for a safe flag_finite_loops value for the resulting function (set some flag in cfun of the function that woul= d be considered together with flag_finite_loops (so that we don't have to create further OPTIMIZATION_NODEs) and disable finite loops opts if we've inlined !flag_finite_loops function into flag_finite_loops one)? =09Jakub