/**
* A Cast may be removed if the type of the previous node
- * is already to type of the Cast.
+ * is already the type of the Cast.
*/
static ir_node *equivalent_node_Cast(ir_node *n) {
ir_node *pred = get_Cast_op(n);
static ir_node *transform_node_Cast(ir_node *n) {
ir_node *oldn = n;
ir_node *pred = get_Cast_op(n);
- type *tp = get_irn_type(pred);
+ type *tp = get_irn_type(n);
if (get_irn_op(pred) == op_Const && get_Const_type(pred) != tp) {
n = new_rd_Const_type(NULL, current_ir_graph, get_nodes_block(pred), get_irn_mode(pred),
get_SymConst_kind(pred), tp);
DBG_OPT_CSTEVAL(oldn, n);
}
+
return n;
}
}
}
- if (tv != tarval_bad) {
+ if ((tv != tarval_bad) && (proj_nr == pn_Cmp_Eq || proj_nr == pn_Cmp_Lg)) {
ir_op *op = get_irn_op(left);
/* a-c1 == c2 ==> a == c2+c1, a-c1 != c2 ==> a != c2+c1 */