From patchwork Mon May 16 08:43:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 54005 Return-Path: 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 4CB3B3857815 for ; Mon, 16 May 2022 08:49:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4CB3B3857815 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1652690977; bh=n1vvLys3wk5lgzrhu2dTatbN9CJ3p5HW6AyTdwA0oHQ=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=qKsMH5k9jT13Ini0YsbEaqNjhmznqE//pFTR1qFDKK2edxtzjOoUp16Y1jUjGAbHP xOxg2oqxV71RHtn7meTi6fWkEmNmPupwo7Gfp5MpkNALHKqnsk/jPLIIgR9/bzKbd7 Po9WJulBfgwEzAFL6yxgDAzqPdqZVihh3JXvnK64= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by sourceware.org (Postfix) with ESMTPS id 85BE23857C6F for ; Mon, 16 May 2022 08:43:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 85BE23857C6F Received: by mail-wr1-x435.google.com with SMTP id a5so15677174wrp.7 for ; Mon, 16 May 2022 01:43:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=n1vvLys3wk5lgzrhu2dTatbN9CJ3p5HW6AyTdwA0oHQ=; b=M+yLpA0hZkVL7Fn0XtJt4xfUahL3ZzwQchW+PURL+ZhivUb6gFy9fb1ya5Z8Z0JnJm TVJ662UP0VgSpRiTI57nsrkZ2KSSDP3E3c5seaXIG+N1eYam/l5P6AVcmCIHMrLP9lyt aqB4gpafqXL9Wxn/crDCuPT9oOLCkBns+X02KQfqHekMlr8W5SOnbs/ijktEpNtR1Xel ePTV52xwFMjHXGe1G10lTs5Q3Phuc2PBOFFHwIuV2P4Z0exWqf8bqf37uitY+vKkewXe iaFzvdeA4TuNqIcW/LAgcJenGkGn6L+uwtC6ZRNT8PbFKm/2chwHxmAGhl0lqppE4q46 wFpg== X-Gm-Message-State: AOAM531dzIzMtjj4drLj6xSLiWviAGKaNqYTcfUB0FrhRtiCsJqXOWag b9Y4Lm3knoxz76s2WZm/IB+34KccJcy6PA== X-Google-Smtp-Source: ABdhPJyhmrs8fM0JJ9M7VfeGbyEUNQVFuXT8BmtyFzNhKrrYoMuW+EzU+oNMEzogNK2iIMvahRQKoA== X-Received: by 2002:adf:e5c3:0:b0:20d:52c:8171 with SMTP id a3-20020adfe5c3000000b0020d052c8171mr4752324wrn.280.1652690582258; Mon, 16 May 2022 01:43:02 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id x10-20020adfbb4a000000b0020d0435c97bsm4181384wrg.92.2022.05.16.01.43.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 01:43:01 -0700 (PDT) Date: Mon, 16 May 2022 08:43:01 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Improve building of untagged equality Message-ID: <20220516084301.GA3843444@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Pierre-Marie de Rodat via Gcc-patches From: Pierre-Marie de Rodat Reply-To: Pierre-Marie de Rodat Cc: Piotr Trojanek Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" When checking components of a record type for their own user-defined equality function it is enough to find just one such a component. Cleanup related to handling of user-defined equality in GNATprove. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch3.adb (Build_Untagged_Equality): Exit early when the outcome of a loop is already known. diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -4541,6 +4541,7 @@ package body Exp_Ch3 is and then Present (User_Defined_Eq (Etype (Comp))) then Build_Eq := True; + exit; end if; Next_Component (Comp);