https://gcc.gnu.org/g:2f0c09c00b8ccf41c27d4b7ba0cafdeb99242a29
commit r15-1179-g2f0c09c00b8ccf41c27d4b7ba0cafdeb99242a29 Author: Andrew MacLeod <amacl...@redhat.com> Date: Thu May 30 09:40:46 2024 -0400 scev query mismatch message Add a message to the listing if SCEV is not invoked because of a range_query mismatch * gimple-range-fold.cc (range_of_ssa_name_with_loop_info): Issue a message if SCEV is not invoked due to a mismatch. Diff: --- gcc/gimple-range-fold.cc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/gcc/gimple-range-fold.cc b/gcc/gimple-range-fold.cc index 98a4877ba18..6037c29ce11 100644 --- a/gcc/gimple-range-fold.cc +++ b/gcc/gimple-range-fold.cc @@ -1267,9 +1267,18 @@ fold_using_range::range_of_ssa_name_with_loop_info (vrange &r, tree name, // SCEV currently invokes get_range_query () for values. If the query // being passed in is not the same SCEV will use, do not invoke SCEV. // This can be remove if/when SCEV uses a passed in range-query. - if (src.query () != get_range_query (cfun) - || !range_of_var_in_loop (r, name, l, phi, src.query ())) - r.set_varying (TREE_TYPE (name)); + if (src.query () != get_range_query (cfun)) + { + r.set_varying (TREE_TYPE (name)); + // Report the msmatch if SRC is not the global query. The cache + // uses a global query and would provide numerous false positives. + if (dump_file && (dump_flags & TDF_DETAILS) + && src.query () != get_global_range_query ()) + fprintf (dump_file, + "fold_using-range:: SCEV not invoked due to mismatched queries\n"); + } + else if (!range_of_var_in_loop (r, name, l, phi, src.query ())) + r.set_varying (TREE_TYPE (name)); } // -----------------------------------------------------------------------