static ir_node *equivalent_node_Block(ir_node *n)
{
ir_node *oldn = n;
- int n_preds = get_Block_n_cfgpreds(n);
+ int n_preds;
- /* The Block constructor does not call optimize, but mature_immBlock
- calls the optimization. */
+ /* don't optimize dead blocks */
+ if (is_Block_dead(n))
+ return n;
+
+ n_preds = get_Block_n_cfgpreds(n);
+
+ /* The Block constructor does not call optimize, but mature_immBlock()
+ calls the optimization. */
assert(get_Block_matured(n));
/* Straightening: a single entry Block following a single exit Block
break;
}
- /* remove Casts */
- if (is_Cast(left))
- left = get_Cast_op(left);
- if (is_Cast(right))
- right = get_Cast_op(right);
+ /* remove Casts of both sides */
+ left = skip_Cast(left);
+ right = skip_Cast(right);
/* Remove unnecessary conversions */
/* TODO handle constants */
}
}
- /* remove operation of both sides if possible */
+ /* remove operation on both sides if possible */
if (proj_nr == pn_Cmp_Eq || proj_nr == pn_Cmp_Lg) {
/*
* The following operations are NOT safe for floating point operations, for instance
static int node_cmp_attr_SymConst(ir_node *a, ir_node *b) {
const symconst_attr *pa = get_irn_symconst_attr(a);
const symconst_attr *pb = get_irn_symconst_attr(b);
- return (pa->num != pb->num)
+ return (pa->kind != pb->kind)
|| (pa->sym.type_p != pb->sym.type_p)
|| (pa->tp != pb->tp);
} /* node_cmp_attr_SymConst */