diff --git a/loopy/schedule/__init__.py b/loopy/schedule/__init__.py
index 975671fa443bf83406dcdb163a109066fe4fafd3..771ba737816e39d496d395dde98b5791cb57369e 100644
--- a/loopy/schedule/__init__.py
+++ b/loopy/schedule/__init__.py
@@ -884,11 +884,6 @@ def generate_loop_schedules_internal(
         if is_ready and debug_mode:
             print("ready to schedule '%s'" % format_insn(kernel, insn.id))
 
-        # Remove the current instruction from the sorted list of instructions
-        # to try
-        new_insn_ids_to_try = list(insn_ids_to_try)
-        new_insn_ids_to_try.remove(insn.id)
-
         if is_ready and not debug_mode:
             iid_set = frozenset([insn.id])
 
@@ -906,14 +901,23 @@ def generate_loop_schedules_internal(
                     else:
                         new_active_group_counts[grp] = (
                                 sched_state.group_insn_counts[grp] - 1)
-                # invalidate instruction to try when active group changes
-                new_insn_ids_to_try = None
-
             else:
                 new_active_group_counts = sched_state.active_group_counts
 
             # }}}
 
+            # {{{ update instruction_ids_to_try
+
+            new_insn_ids_to_try = list(insn_ids_to_try)
+            new_insn_ids_to_try.remove(insn.id)
+
+            # invalidate instruction_ids_to_try when active group changes
+            if set(new_active_group_counts.keys()) != set(
+                    sched_state.active_group_counts.keys()):
+                new_insn_ids_to_try = None
+
+            # }}}
+
             new_uses_of_boostability = []
             if allow_boost:
                 if orig_have & insn.boostable_into: