From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 CC5843858425 for ; Thu, 22 Dec 2022 22:11:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CC5843858425 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671747096; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=t5jp82tx6R2jKzBsUQEmnJoqZBgFjdaSMRMOMFDsxRA=; b=KnzIFKZ88w8qtdLpI3LnDwg6Qoa+QsRfsSj6TfkFv3qixkgiaKgUv8BvgG4yQddLQEkWdr rojlG7VcFlDLP3HCtLy1dkqWghYJ+ZC9eX+T/+1a+7//HKxLKaq/GjJvNRBf7XmNnHIR8C 8plTXMHzZ4+O8EfOLVXUVotx8M3vXec= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-533-A102BKhvMlOq6Ylgbv7n-g-1; Thu, 22 Dec 2022 17:11:34 -0500 X-MC-Unique: A102BKhvMlOq6Ylgbv7n-g-1 Received: by mail-ed1-f71.google.com with SMTP id w15-20020a05640234cf00b0046d32d7b153so2376714edc.0 for ; Thu, 22 Dec 2022 14:11:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=t5jp82tx6R2jKzBsUQEmnJoqZBgFjdaSMRMOMFDsxRA=; b=vf2D52FjjQKL+Eh4m7vcSeLZYcF16bFreykgLPnKo23o9dNyU+N+JXxA7j8V+gZIBz wurg+MGq22wEonYYUACiibt9TRO843eLijNoYxOOVFmkkUxejMy7JT7O15j0ZuR9t2oU yQZSpOW/1sza6wZokTrzJbmlYrnRgY7mdYWDfeLzPbco6jNDVxcR8njM4XJNI6/XG+FD yk2TN60VfHqLYtWDHVFTBg/40WssiG5c8Dt9wboNXqVDXoETNlcDrWXKYkVEm2PtOlPk zqYlkeh915e3f/eGykPdC0mqprPIbTAYOPSVzcf7bwUMnQ6G8H+Baze05b9CMgH0Ay1B riAA== X-Gm-Message-State: AFqh2krp+qyrrwrRkiLsQ+guN7BzSNKpYW7U7PtSKgqxg1JbPaIpdkDJ bP0fpP/WulhOocOMzEVxSKm1c6OYs8twXU7XsN3O/9BBJLKM01nHMUz8mGuzeLw0Gr0bF/SAaTe s0Dcbl17+OoQO/JmjfgbJ4NHNP/1LYFXAww== X-Received: by 2002:a17:907:9a88:b0:812:d53e:1215 with SMTP id km8-20020a1709079a8800b00812d53e1215mr768916ejc.755.1671747093652; Thu, 22 Dec 2022 14:11:33 -0800 (PST) X-Google-Smtp-Source: AMrXdXtSHVjEdIVWqVWsn8ToPEZMiOixIGy5qrvnqN2kJbS0PDSr3m3j5n1pYHqLDZGdxBLS86orsMA22Do1offbqTc= X-Received: by 2002:a17:907:9a88:b0:812:d53e:1215 with SMTP id km8-20020a1709079a8800b00812d53e1215mr768914ejc.755.1671747093487; Thu, 22 Dec 2022 14:11:33 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Aldy Hernandez Date: Thu, 22 Dec 2022 23:11:22 +0100 Message-ID: Subject: Re: [PATCH] phiopt, v2: Adjust instead of reset phires range To: Jakub Jelinek Cc: Richard Biener , gcc-patches , Andrew MacLeod X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="000000000000a9781c05f071f3b6" X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,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 List-Id: --000000000000a9781c05f071f3b6 Content-Type: text/plain; charset="UTF-8" LGTM On Thu, Dec 22, 2022, 22:44 Jakub Jelinek wrote: > On Thu, Dec 22, 2022 at 08:46:33PM +0100, Aldy Hernandez wrote: > > I haven't looked at your problem above, but have you tried using > > int_range_max (or even int_range<2>) instead of value_range above? > > > > value_range is deprecated and uses the legacy anti-range business, > > which has a really hard time representing complex ranges, as well as > > union/intersecting them. > > You're right. With int_range_max it works as I expected. > And no, floating point isn't possible here. > If value_range is right now just the legacy single range or anti-range, > then it explains why it didn't work - while on the first testcase > we could have anti-range ~[0, 0], on the second case [-128, -1] U [1, 127] > is turned into simple legacy [-128, 127]. > > So, ok for trunk if this passes bootstrap/regtest? > > 2022-12-22 Jakub Jelinek > Aldy Hernandez > > * tree-ssa-phiopt.cc (value_replacement): Instead of resetting > phires range info, union it with oarg. > > --- gcc/tree-ssa-phiopt.cc.jj 2022-12-22 12:52:36.588469821 +0100 > +++ gcc/tree-ssa-phiopt.cc 2022-12-22 13:11:51.145060050 +0100 > @@ -1492,11 +1492,25 @@ value_replacement (basic_block cond_bb, > break; > } > if (equal_p) > - /* After the optimization PHI result can have value > - which it couldn't have previously. > - We could instead of resetting it union the range > - info with oarg. */ > - reset_flow_sensitive_info (gimple_phi_result (phi)); > + { > + tree phires = gimple_phi_result (phi); > + if (SSA_NAME_RANGE_INFO (phires)) > + { > + /* After the optimization PHI result can have value > + which it couldn't have previously. */ > + int_range_max r; > + if (get_global_range_query ()->range_of_expr (r, > phires, > + phi)) > + { > + int_range<2> tmp (carg, carg); > + r.union_ (tmp); > + reset_flow_sensitive_info (phires); > + set_range_info (phires, r); > + } > + else > + reset_flow_sensitive_info (phires); > + } > + } > if (equal_p && MAY_HAVE_DEBUG_BIND_STMTS) > { > imm_use_iterator imm_iter; > > > Jakub > > --000000000000a9781c05f071f3b6--