public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] tree-optimization/67196 - normalize use predicates earlier
@ 2022-08-30 11:13 Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2022-08-30 11:13 UTC (permalink / raw)
  To: gcc-patches

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] tree-optimization/67196 - normalize use predicates earlier
@ 2022-08-30 11:13 Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2022-08-30 11:13 UTC (permalink / raw)
  To: gcc-patches

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-30 11:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-30 11:13 [PATCH] tree-optimization/67196 - normalize use predicates earlier Richard Biener
  -- strict thread matches above, loose matches on Subject: below --
2022-08-30 11:13 Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).