-#endif
-
- ef = xmalloc(sizeof(ef[0]));
- memset(ef, 0, sizeof(ef[0]));
- ef->min_non_zero = 1e50; /* initialize with a reasonable large number. */
- freqs = ef->set = new_set(cmp_freq, 32);
+ double norm;
+
+ /*
+ * compute a DFS.
+ * using a toposort on the CFG (without back edges) will propagate
+ * the values better for the gauss/seidel iteration.
+ * => they can "flow" from start to end.
+ */
+ dfs = dfs_new(&absgraph_irg_cfg_succ, irg);
+ ef = XMALLOCZ(ir_exec_freq);
+ ef->min_non_zero = HUGE_VAL; /* initialize with a reasonable large number. */
+ freqs = ef->set = new_set(cmp_freq, dfs_get_n_nodes(dfs));
+
+ /*
+ * Populate the exec freq set.
+ * The DFS cannot be used alone, since the CFG might not be connected
+ * due to unreachable code.
+ */
+ irg_block_walk_graph(irg, collect_blocks, NULL, freqs);