From patchwork Mon Jun 26 11:01:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 112850 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7393235vqr; Mon, 26 Jun 2023 04:02:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7VI8WdWv4U6VCnACn3tNKp8XLCFXscQMAG+brN+ldXo3nDCAn4i3DtOjv4SBw8I6SizKwy X-Received: by 2002:a17:906:9b8b:b0:98c:ef87:17ea with SMTP id dd11-20020a1709069b8b00b0098cef8717eamr10415101ejc.13.1687777346774; Mon, 26 Jun 2023 04:02:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687777346; cv=none; d=google.com; s=arc-20160816; b=N9yvUcxOtcBS6uOexFNRPBXCa/IPom+g45NLFYrl1CqQ4AsXsIoV/T6Q/wsgu0BaIw cZEdcoCcgZupcO1qmjA2XnSun26Km8irVxYMUR7m9Gq86kraCwhOvyouV8siI9Uccz9K FBuk0U/Vx0nh32wrPa9uHmX5KFbVq5zAuElq+04gG73sodE8M4KtaSnK15gj7BdBhGB6 vYufsZtmSmzzN79YWsYMmekJu6PV3mXJx1Z0OL0HX/5t9eaciIehxKHwMTWxkK7juyz0 dxGqt072PrMjFL54UTkwxD2Dw5lA4XZXnlOStZ5HNms96unWDBzTmwGrFJ43EAUCpL/C c9cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:sender:errors-to:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mime-version:user-agent:subject:to:date:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=r04qR5KQz1fC2VhPDaBeGpNukh7fTulH0bHkTKTO8MY=; fh=hPrbWPhweUx4V0GV9uXJqbyAzg2ABmTz7kczrAQqMmM=; b=IPPMw61WRrScHuEK5M6TXyuN66tZuhJ+PBKg8a3aGbSOlyyzYtR+JZgX7aJQBuxeZh 5l0vEU3rnlZu/UDcQm8JULULQEqFQZdEq5y534kLiYPnp5+9r2zcp3GZjDFcuOfsRouV a/Pzj6kKW1Z5jdKqc1jB3XvxJK21y2TE0hOIg5gFQXht+/pSIHM+ogYuLNfpo7OlMlWx 5rgKuQ0JIw/wLMxbS2UinXZuqW0n3xTwZsatvZe9XOUj4igjMMqBr77N4+g1z32BDB5X fJFk3tc9Uwweh5wEq5YcHe76vOj/f324HxZ4krC3KgA2di0/gqNV/iNZ8262pc3W8lp+ PJJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=gncn0wNF; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id u21-20020a1709064ad500b00978ae651cacsi2666446ejt.0.2023.06.26.04.02.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 04:02:26 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=gncn0wNF; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D451938582A4 for ; Mon, 26 Jun 2023 11:02:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D451938582A4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687777343; bh=r04qR5KQz1fC2VhPDaBeGpNukh7fTulH0bHkTKTO8MY=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=gncn0wNFbKeNp0TLN/dxJrikomde6y+h0RYWBx11JT6bBJvW7qHBziCAt4b1v3O7e 01yhjI7QDV3ncliUNFim+w+F19P4SdSSH1nVnE26G+VUovpVqJISJ/4KvkDsQN5KUB hYMqp32RChgAsaajAVd+FDSabQsevSGccOB72obM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 8E49A3858D1E for ; Mon, 26 Jun 2023 11:01:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8E49A3858D1E Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 869C21F7AB for ; Mon, 26 Jun 2023 11:01:39 +0000 (UTC) Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 7E0892C141 for ; Mon, 26 Jun 2023 11:01:39 +0000 (UTC) Date: Mon, 26 Jun 2023 11:01:39 +0000 (UTC) To: gcc-patches@gcc.gnu.org Subject: [PATCH] tree-optimization/110392 - ICE with predicate analysis User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MISSING_MID, 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: Richard Biener via Gcc-patches From: Richard Biener Reply-To: Richard Biener Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" Message-Id: <20230626110223.D451938582A4@sourceware.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769762819025599289?= X-GMAIL-MSGID: =?utf-8?q?1769762819025599289?= Feeding not optimized IL can result in predicate normalization to simplify things so a predicate can get true or false. The following re-orders the early exit in that case to come after simplification and normalization to take care of that. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. PR tree-optimization/110392 * gimple-predicate-analysis.cc (uninit_analysis::is_use_guarded): Do early exits on true/false predicate only after normalization. --- gcc/gimple-predicate-analysis.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/gimple-predicate-analysis.cc b/gcc/gimple-predicate-analysis.cc index 7f20f81ad86..373163ba9c8 100644 --- a/gcc/gimple-predicate-analysis.cc +++ b/gcc/gimple-predicate-analysis.cc @@ -2216,11 +2216,11 @@ uninit_analysis::is_use_guarded (gimple *use_stmt, basic_block use_bb, return false; use_preds.simplify (use_stmt, /*is_use=*/true); + use_preds.normalize (use_stmt, /*is_use=*/true); if (use_preds.is_false ()) return true; if (use_preds.is_true ()) return false; - use_preds.normalize (use_stmt, /*is_use=*/true); /* Try to prune the dead incoming phi edges. */ if (!overlap (phi, opnds, visited, use_preds)) @@ -2238,11 +2238,11 @@ uninit_analysis::is_use_guarded (gimple *use_stmt, basic_block use_bb, return false; m_phi_def_preds.simplify (phi); + m_phi_def_preds.normalize (phi); if (m_phi_def_preds.is_false ()) return false; if (m_phi_def_preds.is_true ()) return true; - m_phi_def_preds.normalize (phi); } /* Return true if the predicate guarding the valid definition (i.e.,