Don't use ANY PHI equivalences in range-on-entry.
authorAndrew MacLeod <amacleod@redhat.com>
Tue, 11 Apr 2023 21:29:03 +0000 (17:29 -0400)
committerAndrew MacLeod <amacleod@redhat.com>
Wed, 12 Apr 2023 13:07:20 +0000 (09:07 -0400)
PR 108139 dissallows PHI equivalencies in the on-entry calculator, but
it was only checking if the equivlaence was a PHI.  In this case, NAME
itself is a PHI with an equivlaence caused by an undefined value, so we
also need to check that case.  Unfortunately this un-fixes 101912.

PR tree-optimization/109462
gcc/
* gimple-range-cache.cc (ranger_cache::fill_block_cache): Don't
check for equivalences if NAME is a phi node.

gcc/testsuite/
* gcc.dg/uninit-pr101912.c: XFAIL the warning.

gcc/gimple-range-cache.cc
gcc/testsuite/gcc.dg/uninit-pr101912.c

index 6a098d8..3b52f1e 100644 (file)
@@ -1218,7 +1218,9 @@ ranger_cache::fill_block_cache (tree name, basic_block bb, basic_block def_bb)
          fprintf (dump_file, "\n");
        }
       // See if any equivalences can refine it.
-      if (m_oracle)
+      // PR 109462, like 108139 below, a one way equivalence introduced
+      // by a PHI node can also be through the definition side.  Disallow it.
+      if (m_oracle && !is_a<gphi *> (SSA_NAME_DEF_STMT (name)))
        {
          tree equiv_name;
          relation_kind rel;
index 1550c03..62cd2a0 100644 (file)
@@ -11,7 +11,7 @@ tzloadbody (void)
   for (int i = 0; i < n; i++)
     {
       int corr = getint ();
-      if (corr < 1 || (corr == 1 && !(leapcnt == 0 || (prevcorr < corr ? corr == prevcorr + 1 : (corr == prevcorr || corr == prevcorr - 1))))) /* { dg-bogus "uninitialized" } */
+      if (corr < 1 || (corr == 1 && !(leapcnt == 0 || (prevcorr < corr ? corr == prevcorr + 1 : (corr == prevcorr || corr == prevcorr - 1))))) /* { dg-bogus "uninitialized" "pr101912" { xfail *-*-* } } */
        return -1;
 
       prevcorr = corr;