Let the block walker enter endless loops only at kept blocks, not Phis.
authorChristoph Mallon <christoph.mallon@gmx.de>
Thu, 14 Apr 2011 09:26:00 +0000 (11:26 +0200)
committerChristoph Mallon <christoph.mallon@gmx.de>
Thu, 14 Apr 2011 09:26:00 +0000 (11:26 +0200)
- This is sufficient, because every endless loop must have one kept block.
- This also prevents that the if-conversion enters endless loops at strange points.
  This lead to exchanging a block, which is currently being recursed, so when later returning to the exchanged block (which now is an Id-node) in the walker stuff blew up.

ir/ir/irgwalk.c

index 440dc61..27ac9cb 100644 (file)
@@ -396,11 +396,9 @@ void irg_block_walk(ir_node *node, irg_walk_func *pre, irg_walk_func *post, void
                for (i = 0; i < arity; i++) {
                        pred = get_irn_n(node, i);
                        if (!is_Block(pred)) {
-                               pred = get_nodes_block(pred);
-                               if (!is_Block(pred)) {
-                                       /* if rare cases a kept node might have a bad block input */
-                                       continue;
-                               }
+                               /* It is sufficient to enter endless loops just at kept blocks, because
+                                * every endless loop must have one. */
+                               continue;
                        }
                        /* Sometimes the blocks died, but are still reachable through kept nodes.
                         * Make sure the algorithms that try to remove these reach them. */