- DBG((mod, LEVEL_1, "removing equal perm register pair (%+F, %+F, %s)\n",
- pairs[i].in_node, pairs[i].out_node, pairs[i].out_reg->name));
- /* If scheduling point and in-node are the same, then get the scheduling
- pred of this node, otherwise we would break the scheduling list */
- if (sched_point == pairs[i].in_node) {
- sched_point = sched_prev(sched_point);
+ DBG((mod, LEVEL_1, "%+F removing equal perm register pair (%+F, %+F, %s)\n",
+ irn, pairs[i].in_node, pairs[i].out_node, pairs[i].out_reg->name));
+
+ /* We have to check for a special case:
+ The in-node could be a Proj from a Perm. In this case,
+ we need to correct the projnum */
+ if (is_Perm(arch_env, pairs[i].in_node) && is_Proj(pairs[i].in_node)) {
+ set_Proj_proj(pairs[i].out_node, get_Proj_proj(pairs[i].in_node));