This change takes loops of the form:

  for (int <i> = 0; <i> < FIRST_PSEUDO_REGISTER; <i>++)
    if (TEST_HARD_REG_BIT (<set>, <i>))
      <body that doesn't change i or set>

and carries out the necessary refactoring to rewrite them as:

  hard_reg_set_iterator hrsi; [...]
  EXECUTE_IF_SET_IN_HARD_REG_SET (<set>, 0, <i>, hrsi)
    <body that doesn't change i or set>

in loops where expressing <set> does not involve <i>.

gcc/
        * sched-deps.cc: Changed the two applicable loops.

Signed-off-by: Kevin Stefanov <[email protected]>
---
I have the same one test that appears as both 'New tests that PASS'
and under 'Old tests that passed, that have disappeared, which is
g++: g++.dg/modules/compile-std1.C module-cmi <bits/stdc++.h>.
I also this time for some reason have 6 tests that work, but didn't before:
g++: g++.dg/gomp/deprecate-1.C  -std=c++20  expected multiline pattern lines 
119-121
g++: g++.dg/gomp/deprecate-1.C  -std=c++20 (test for excess errors)
g++: g++.dg/gomp/deprecate-1.C  -std=c++26  expected multiline pattern lines 
119-121
g++: g++.dg/gomp/deprecate-1.C  -std=c++26 (test for excess errors)
g++: g++.dg/gomp/deprecate-1.C  -std=c++98  expected multiline pattern lines 
119-121
g++: g++.dg/gomp/deprecate-1.C  -std=c++98 (test for excess errors)

 gcc/sched-deps.cc | 31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/gcc/sched-deps.cc b/gcc/sched-deps.cc
index 1818a077bda..ef4728d753b 100644
--- a/gcc/sched-deps.cc
+++ b/gcc/sched-deps.cc
@@ -3149,22 +3149,21 @@ sched_analyze_insn (class deps_desc *deps, rtx x, 
rtx_insn *insn)
            }
        }
 
-      for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
-       if (TEST_HARD_REG_BIT (implicit_reg_pending_uses, i))
-         {
-           struct deps_reg *reg_last = &deps->reg_last[i];
-           add_dependence_list (insn, reg_last->sets, 0, REG_DEP_TRUE, false);
-           add_dependence_list (insn, reg_last->implicit_sets, 0,
-                                REG_DEP_ANTI, false);
-           add_dependence_list (insn, reg_last->clobbers, 0, REG_DEP_TRUE,
-                                false);
+    hard_reg_set_iterator hrsi;
+       EXECUTE_IF_SET_IN_HARD_REG_SET(implicit_reg_pending_uses, 0, i , hrsi)
+       {
+         struct deps_reg *reg_last = &deps->reg_last[i];
+         add_dependence_list (insn, reg_last->sets, 0, REG_DEP_TRUE, false);
+         add_dependence_list (insn, reg_last->implicit_sets, 0, REG_DEP_ANTI,
+                                                  false);
+         add_dependence_list (insn, reg_last->clobbers, 0, REG_DEP_TRUE, 
false);
 
-           if (!deps->readonly)
-             {
-               reg_last->uses = alloc_INSN_LIST (insn, reg_last->uses);
-               reg_last->uses_length++;
-             }
+         if (!deps->readonly)
+         {
+           reg_last->uses = alloc_INSN_LIST (insn, reg_last->uses);
+           reg_last->uses_length++;
          }
+       }
 
       if (targetm.sched.exposed_pipeline)
        {
@@ -3309,8 +3308,8 @@ sched_analyze_insn (class deps_desc *deps, rtx x, 
rtx_insn *insn)
        }
     }
 
-  for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
-    if (TEST_HARD_REG_BIT (implicit_reg_pending_clobbers, i))
+  hard_reg_set_iterator hrsi;
+  EXECUTE_IF_SET_IN_HARD_REG_SET (implicit_reg_pending_clobbers, 0, i, hrsi)
       {
        struct deps_reg *reg_last = &deps->reg_last[i];
        add_dependence_list (insn, reg_last->sets, 0, REG_DEP_ANTI, false);
-- 
2.53.0

Reply via email to