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 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) 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 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: Tue, 30 Aug 2022 11:13:55 -0000 Message-ID: <20220830111344.OQ9J61s-yWrObxGkrYdsDBkSyvMuge7kI6xgTWlQqwQ@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