move adt headers
[libfirm] / ir / ana / execfreq.c
index eafdba8..1e2526f 100644 (file)
@@ -45,6 +45,7 @@
 #include "firm_common_t.h"
 #include "set.h"
 #include "hashptr.h"
+#include "debug.h"
 
 #include "irprog_t.h"
 #include "irgraph_t.h"
@@ -257,7 +258,11 @@ compute_execfreq(ir_graph * irg, double loop_weight)
        freqs = ef->set = new_set(cmp_freq, 32);
 
        construct_cf_backedges(irg);
-       edges_assure(irg);
+       /* TODO: edges are corrupt for EDGE_KIND_BLOCK after the local optimize
+                graph phase merges blocks in the x86 backend */
+       edges_deactivate(irg);
+       edges_activate(irg);
+       /* edges_assure(irg); */
 
        wd.idx = 0;
        wd.set = freqs;
@@ -292,6 +297,7 @@ compute_execfreq(ir_graph * irg, double loop_weight)
 
        x = solve_lgs(matrix, rhs, size);
        if (x == NULL) {
+               DEBUG_ONLY(ir_fprintf(stderr, "Debug Warning: Couldn't estimate execution frequencies for %+F\n", irg));
                ef->infeasible = 1;
        } else {
                ef->max = 0.0;
@@ -367,15 +373,15 @@ compute_execfreq(ir_graph * irg, double loop_weight)
 #ifdef USE_GSL
                gsl_vector_free(x);
 #endif
-               free(matrix);
-               free(rhs);
-
                memset(&ef->hook, 0, sizeof(ef->hook));
                ef->hook.context = ef;
                ef->hook.hook._hook_node_info = exec_freq_node_info;
                register_hook(hook_node_info, &ef->hook);
        }
 
+       free(matrix);
+       free(rhs);
+
        return ef;
 }