diff --git a/loopy/preprocess.py b/loopy/preprocess.py
index 229c6b7caafb17c309746edefffff88019ef4f50..68ef6062ef9ba1d81920154444a7018797d10bd3 100644
--- a/loopy/preprocess.py
+++ b/loopy/preprocess.py
@@ -1289,7 +1289,7 @@ def realize_reduction(kernel, insn_id_filter=None, unknown_types_ok=True,
 
         new_insn_add_depends_on.add(prev_id)
         new_insn_add_no_sync_with.add((prev_id, "any"))
-        new_insn_add_within_inames.add(stage_exec_iname or base_exec_iname)
+        new_insn_add_within_inames.add(base_exec_iname or stage_exec_iname)
 
         if nresults == 1:
             assert len(acc_vars) == 1