From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id 9403C3858D32 for ; Mon, 26 Sep 2022 11:08:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9403C3858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wm1-x331.google.com with SMTP id z13-20020a7bc7cd000000b003b5054c6f9bso6737313wmk.2 for ; Mon, 26 Sep 2022 04:08:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=VOU+TQO/4s9Vz8cySD/TZCH55P9waR2d9O88UAHHc/E=; b=blXnTwostSwel0NFfxocKvhtrv4+/1maP33x2crCGJkXFlrnDYWdSw2529b38Varts xKFsp8doGgRYuF9Euvu372XR7iAPoUGtP+8YKFPJtcB/yaXlij+aAnwqOHFd+hleCCFj 797gYlJFbJ7smjVuTDUl84N5trnNt0zIxsyzFRIuKMIhIfF8W4DwGqc2TlJ0IFaWdDoR RNOyBdzJHCrUK0Nt2qxeGnPo3MusznXtbwWZ4UYxKAzYUZL4x7WAHwpxrTDf/z92l54e SNHlxgbMjoTCW5eHLEMIgmkzX/TuCPyyA/oInS49feCkW2b+qLIV4zNL/XVrxQQFDVBd 0lqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=VOU+TQO/4s9Vz8cySD/TZCH55P9waR2d9O88UAHHc/E=; b=KWvAZ5Aj7T75HIThrFxVOJqQVv5TAZdhDxOlQLAkTO2QihHgY4Dnr3c/xgp4S5Sg7u 8K3qLhLavmclYdXfL4rchYUBZUe1WRxYGM5U4EZQtq1sQNryZ1EsDP2e34LCoMqR3REZ U3JCXYovSPNGyefZ2rjVaztRFq1OFi1iM80dtYBdJiItn8Hk0gdl4vgpUjFpM2dZOAbp jpcE5+/CO3vcYYUpOtre6Qg2LwY5+XCznNCiMHlTRsbooayR/xOHE6qNB+FVwT/T/97+ fLZ3h7FU3wfVaZ8e4HlaavTeS4eq/GGlGGcR5ShEBQ3T9r1DV/N6/4utlcFvqTBhHo/R MvwQ== X-Gm-Message-State: ACrzQf01v01XEw05xla/u4qmpH8aifpTSx8ePFEnj892YL1uvW8SWud7 biIKTfI6vBc1cSGihR3GbXqQ3g== X-Google-Smtp-Source: AMsMyM5MpXM49Nht3Sc4/JkQGtihODvPFjhr6HlrLg97qwtjP0/wmohWlD+BXDpo/bP+0WYbm/czjA== X-Received: by 2002:a05:600c:4856:b0:3b4:9aa3:cb57 with SMTP id j22-20020a05600c485600b003b49aa3cb57mr14960632wmo.116.1664190513301; Mon, 26 Sep 2022 04:08:33 -0700 (PDT) Received: from fomalhaut.localnet ([2a01:e0a:8d5:d990:e654:e8ff:fe8f:2ce6]) by smtp.gmail.com with ESMTPSA id c1-20020adffb01000000b00228da396f9dsm14188768wrr.84.2022.09.26.04.08.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 04:08:32 -0700 (PDT) From: Eric Botcazou X-Google-Original-From: Eric Botcazou To: Richard Biener Cc: Tamar Christina , gcc-patches@gcc.gnu.org, nd@arm.com, gcc-patches@gcc.gnu.org Subject: Re: [PATCH]middle-end fix floating out of constants in conditionals Date: Mon, 26 Sep 2022 13:08:31 +0200 Message-ID: <3197460.44csPzL39Z@fomalhaut> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,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.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > I think the better fix would be to only consider TREE_CONSTANT (arg) > if it wasn't constant initially. Because clearly "simplify" intends > to be "constant" here. In fact I wonder why we test !TREE_CONSTANT (arg) > at all, we don't simplify 'arg' ... > > Eric added this test (previosuly we'd just always done the folding), > but I think not enough? Before my change we had always done the folding *only* for TREE_CONSTANT (arg) and my change allowed it for some cases of !TREE_CONSTANT (arg), but I did not want to touch the !TREE_CONSTANT (arg) case at all: * fold-const.c (fold_binary_op_with_conditional_arg): Do not restrict the folding to constants. Remove redundant final conversion. Tamar's issue appears to be for TREE_CONSTANT (arg) so orthogonal to mine. -- Eric Botcazou