]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/67196 - normalize use predicates earlier
authorRichard Biener <rguenther@suse.de>
Tue, 30 Aug 2022 09:47:49 +0000 (11:47 +0200)
committerRichard Biener <rguenther@suse.de>
Tue, 30 Aug 2022 11:14:33 +0000 (13:14 +0200)
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.

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
gcc/testsuite/gcc.dg/uninit-pred-7_a.c

index 2b279ccd4b6aee0fe9ec0b3313aa95bd85295260..f8c63d24537a1d83aac28def6a4b51ed3dbbdb65 100644 (file)
@@ -2105,6 +2105,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))
     {
@@ -2124,9 +2127,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).  */
index 434d90ac57038f7e4d7d617b767e40917bea5100..c2ba2a4248d707b8d2bd6d112d525c4d89984c8a 100644 (file)
@@ -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;
 }