From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by sourceware.org (Postfix) with ESMTPS id E67CD3857C67 for ; Fri, 16 Jul 2021 07:07:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E67CD3857C67 Received: by mail-ed1-x52e.google.com with SMTP id v1so11616315edt.6 for ; Fri, 16 Jul 2021 00:07:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=EA60C5jkasMI5BA3mvClNxdnPqwNsjVRMepDkA1hT6c=; b=RTMUMuqfMXndCMaw5xCOQjv3W3KT8pfmhMCrmuzGIn6D8/W5lh21Ma2iwqG8e45WtI DkhYfBI3MHu/Byb1Vt/qQgcH4OuMTRmzUGy8tNq5zbI3pnyXdr9itx3fc+yDRP+PXIth L/Jtn5NSrV/GdsrDRZGg083kCcTOJDYeZ5B0Sq3YBqK+RS5Lg+jQLRRIlyGR8ZdZ3cb/ qCgkHnthDCFI1tZ6KF7lF91tZDJaVkxo35ujNuCqSYNPu2nQffGyvHWUd0dSEOigEeBa pNJSXAxYiwjZ5/9d314+YAz4HPNjXqva9VxiYJzspRwSBf/ippraUNMfAuciqUsj++Og OzNw== X-Gm-Message-State: AOAM530uxOoikFlf0xRYFmjWQi8diylNisNOiyVpIH6C0OIWQVtwz8gM 2cWWhdgVWc/ua1sD5z7PjHzuN+tlacMS1PZDwtY= X-Google-Smtp-Source: ABdhPJzquxVZu4z6Imt1pIOqRbcM3JXamHKNd1lho4vggEqbrGjdAtwskXCuEKo0cGVeXuHAyviF4bFUAb4QDpjMd64= X-Received: by 2002:aa7:c808:: with SMTP id a8mr12681245edt.245.1626419272083; Fri, 16 Jul 2021 00:07:52 -0700 (PDT) MIME-Version: 1.0 References: <20210623150305.411460-1-aldyh@redhat.com> <21075381-4311-3e94-f48b-015373880c7c@redhat.com> <20210624134548.GS7746@tucnak> <93773969-4bab-94e4-2edb-67796c6c9049@redhat.com> In-Reply-To: <93773969-4bab-94e4-2edb-67796c6c9049@redhat.com> From: Richard Biener Date: Fri, 16 Jul 2021 09:07:41 +0200 Message-ID: Subject: Re: [COMMITTED] Add gimple_range_type for statements. To: Andrew MacLeod Cc: Aldy Hernandez , Jakub Jelinek , Aldy Hernandez via Gcc-patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Fri, 16 Jul 2021 07:07:54 -0000 On Thu, Jul 15, 2021 at 10:00 PM Andrew MacLeod wrote: > > On 7/15/21 9:06 AM, Richard Biener wrote: > > On Thu, Jul 15, 2021 at 1:06 PM Aldy Hernandez wrote: > >> > >> Currently gimple_expr_type is ICEing because it calls gimple_call_return_type. > >> > >> I still think gimple_call_return_type should return void_type_node > >> instead of ICEing, but this will also fix my problem. > >> > >> Anyone have a problem with this? > > It's still somewhat inconsistent, no? Because for a call without a LHS > > it's now either void_type_node or the type of the return value. > > > > It's probably known I dislike gimple_expr_type itself (it was introduced > > to make the transition to tuples easier). I wonder why you can't simply > > fix range_of_call to do > > > > tree lhs = gimple_call_lhs (call); > > if (lhs) > > type = TREE_TYPE (lhs); > > > > Richard. > > You are correct. There are indeed inconsistencies, and they exist in > multiple places. In fact, none of them do exactly what we are looking > for all the time, and there are times we do care about the stmt when > there is no LHS. In addition, we almost always then have to check > whether the type we found is supported. > > So instead, much as we did for types with range_compatible_p (), we'll > provide a function for statements which does exactly what we need. This > patch eliminates all the ranger calls to both gimple_expr_type () and > gimple_call_return_type () . This will also simplify the life of > anyone who goes to eventually remove gimple_expr_type () as there will > now be less uses. Thanks a lot! Richard. > The function will return a type if and only if we can find the type in > an orderly fashion, and then determine if it is also supported by ranger. > > Bootstrapped on x86_64-pc-linux-gnu with no regressions. Pushed. > > Andrew >