From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id A39DB3839058 for ; Tue, 30 Aug 2022 11:13:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A39DB3839058 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id C647C21F99 for ; Tue, 30 Aug 2022 11:13:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1661858024; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=LGoai6+mXqFWFZ77N/k6oUd1xZLKvd83o3Qalme3lW0=; b=j6PuWJEzVK7XLCtnA/KPB5aeqn8sDpyISIEl/xh2ennZrzGWV2CY1BXfiayKPP9yiWnT9P SPZCEh7DNA/vbbH9FrNiYpt12kQkyE3XCXNZuvfulSKS1ijEQXQctDah/187J9sOTysYhH v9nMqoUyuR+xtDzKOHZQcRc0Qw/1lgs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1661858024; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=LGoai6+mXqFWFZ77N/k6oUd1xZLKvd83o3Qalme3lW0=; b=u6M6iNodj1hZrkgcoQeMoTmjv1jdrpyecKGmMljEWSbvtyiU5qsW/DO0zClaGHrzCsO+R4 zV/xFhyoOD6YxPCA== 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 BFF102C141 for ; Tue, 30 Aug 2022 11:13:44 +0000 (UTC) Date: Tue, 30 Aug 2022 11:13:44 +0000 (UTC) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] tree-optimization/67196 - normalize use predicates earlier User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-10.6 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 List-Id: Message-ID: <20220830111344.RYG9Rir8TLKxdgHABnfLzIQJrSYVFQ7-4AXMs0vYHGA@z> The following makes sure to have use predicates simplified and normalized before doing uninit_analysis::overlap because that otherwise cannot pick up all flag setting cases. This fixes half of the issue in PR67196 and conveniently resolves the XFAIL in gcc.dg/uninit-pred-7_a.c. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. PR tree-optimization/67196 * gimple-predicate-analysis.cc (uninit_analysis::is_use_guarded): Simplify and normalize use prediates before first use. * gcc.dg/uninit-pred-7_a.c: Un-XFAIL. --- gcc/gimple-predicate-analysis.cc | 6 +++--- gcc/testsuite/gcc.dg/uninit-pred-7_a.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gcc/gimple-predicate-analysis.cc b/gcc/gimple-predicate-analysis.cc index ffdd8a15fe7..62a13c39d7a 100644 --- a/gcc/gimple-predicate-analysis.cc +++ b/gcc/gimple-predicate-analysis.cc @@ -2087,6 +2087,9 @@ uninit_analysis::is_use_guarded (gimple *use_stmt, basic_block use_bb, if (!init_use_preds (use_preds, def_bb, use_bb)) return false; + use_preds.simplify (use_stmt, /*is_use=*/true); + use_preds.normalize (use_stmt, /*is_use=*/true); + /* Try to prune the dead incoming phi edges. */ if (!overlap (phi, opnds, visited, use_preds)) { @@ -2106,9 +2109,6 @@ uninit_analysis::is_use_guarded (gimple *use_stmt, basic_block use_bb, m_phi_def_preds.normalize (phi); } - use_preds.simplify (use_stmt, /*is_use=*/true); - use_preds.normalize (use_stmt, /*is_use=*/true); - /* Return true if the predicate guarding the valid definition (i.e., *THIS) is a superset of the predicate guarding the use (i.e., USE_PREDS). */ diff --git a/gcc/testsuite/gcc.dg/uninit-pred-7_a.c b/gcc/testsuite/gcc.dg/uninit-pred-7_a.c index 434d90ac570..c2ba2a4248d 100644 --- a/gcc/testsuite/gcc.dg/uninit-pred-7_a.c +++ b/gcc/testsuite/gcc.dg/uninit-pred-7_a.c @@ -23,7 +23,7 @@ int foo (int n, int l, int m, int r) blah(v); /* { dg-bogus "uninitialized" "bogus warning" } */ if ( l ) - blah(v); /* { dg-bogus "uninitialized" "bogus warning" { xfail *-*-* } } */ + blah(v); /* { dg-bogus "uninitialized" "bogus warning" } */ return 0; } -- 2.35.3