enable Rot constant folding (why was it commented out)
[libfirm] / ir / ir / irvrfy.c
index fecd043..ac88693 100644 (file)
@@ -258,9 +258,12 @@ vrfy_Proj_proj(ir_node *p, ir_graph *irg) {
 
     case iro_Cond:
       ASSERT_AND_RET_DBG(
-        (proj >= 0 && mode == mode_X),
-    "wrong Proj from Cond", 0,
-    show_proj_failure(p);
+       (
+          (proj >= 0 && mode == mode_X && get_irn_mode(get_Cond_selector(pred)) == mode_b) ||  /* compare */
+         (mode == mode_X && mode_is_int(get_irn_mode(get_Cond_selector(pred))))                /* switch */
+       ),
+        "wrong Proj from Cond", 0,
+        show_proj_failure(p);
       );
       break;
 
@@ -669,7 +672,7 @@ int irn_vrfy_irg(ir_node *n, ir_graph *irg)
       if (tarval_is_entity(tv))
          ASSERT_AND_RET(
                         (get_irn_irg(n) == get_const_code_irg()) ||
-                        (get_entity_peculiarity(tarval_to_entity(tv)) != peculiarity_description),
+                        (get_entity_peculiarity(get_tarval_entity(tv)) != peculiarity_description),
                         "descriptions have no address", 0);
          ASSERT_AND_RET(
                         /* Const: BB --> data */
@@ -680,6 +683,16 @@ int irn_vrfy_irg(ir_node *n, ir_graph *irg)
      } break;
 
     case iro_SymConst:
+      if (get_SymConst_kind(n) == symconst_addr_ent) {
+       entity *ent = get_SymConst_entity(n);
+       if (is_method_type(get_entity_type(ent)) &&
+           get_irn_irg(n) != get_const_code_irg()) {
+#if 0
+         ASSERT_AND_RET((get_entity_peculiarity(ent) != peculiarity_description),
+                        "A constant must address an existing method.", 0);
+#endif
+       }
+      }
       ASSERT_AND_RET(
                      /* SymConst: BB --> int*/
                      (mode_is_int(mymode) ||