https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127687

--- Comment #4 from Yongqiang Tian <yqtian668 at gmail dot com> ---
(In reply to Jakub Jelinek from comment #3)
> Started with r15-5563-g1c4d39ada33d3655db088a0e5c90a296da794a55
> 
> I wonder if debug stmts shouldn't be skipped earlier, before assigning uids,
> nothing should check uids of debug stmts in the pass and by only assigning
> uids to non-debug they will be consistent.

Thanks a lot. I drafted the attached patch based on your suggestion. It skips
debug statements before assigning statement UIDs, so they neither consume UIDs
nor terminate pending vec-perm simplify sequences.

diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc
index f341514a8e..fba4387f50 100644
--- a/gcc/tree-ssa-forwprop.cc
+++ b/gcc/tree-ssa-forwprop.cc
@@ -6755,6 +6755,12 @@ pass_forwprop::execute (function *fun)
          tree lhs, rhs;
          enum tree_code code;

+         if (is_gimple_debug (stmt))
+           {
+             gsi_next (&gsi);
+             continue;
+           }
+
          gimple_set_uid (stmt, uid++);

          if (!is_gimple_assign (stmt))


I also added a dedicated -fcompare-debug test that checks the sequences are
still blended. The targeted test fails before the change and passes with it. A
full bootstrap and regression test is still running...

If you think this is ok, may I submit a patch once the full testing is done?

Thanks a lot for the advice.

Reply via email to