Simple Load/Store optimization
[libfirm] / ir / opt / tailrec.c
index bf9e48f..356ee94 100644 (file)
@@ -24,7 +24,6 @@
 #include "irgraph_t.h"
 #include "ircons.h"
 #include "irflag.h"
-#include "tv.h"
 #include "firmstat.h"
 
 /**
@@ -190,6 +189,8 @@ static void do_opt_tail_rec(ir_graph *irg, ir_node *rets, int n_tail_calls)
     in[i] = get_Call_mem(calls);
     ++i;
   }
+  assert(i == n_tail_calls + 1);
+
   phis[0] = new_rd_Phi(NULL, irg, block, n_tail_calls + 1, in, mode_M);
 
   /* build the data phi's */
@@ -253,7 +254,6 @@ void opt_tail_rec_irg(ir_graph *irg)
   for (i = 0; i < n_preds; ++i) {
     ir_node *ret = get_Block_cfgpred(end_block, i);
     ir_node *proj_m, *call, *call_ptr;
-    tarval *tv;
     entity *ent;
     int j, n_ress;
     ir_node **ress;
@@ -278,6 +278,9 @@ void opt_tail_rec_irg(ir_graph *irg)
     if (get_irn_op(call_ptr) != op_SymConst)
       continue;
 
+    if (get_SymConst_kind(call_ptr) != symconst_addr_ent)
+      continue;
+
     ent = get_SymConst_entity(call_ptr);
     if (!ent || get_entity_irg(ent) != irg)
       continue;