Commit 869a57a3 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Cmp(Conv(x), 0) -> Cmp(x, 0) if dest mode ist wider than source mode.

[r15829]
parent 291fe400
......@@ -3432,6 +3432,24 @@ static ir_node *transform_node_Proj_Cmp(ir_node *proj) {
}
}
/* TODO extend to arbitrary constants */
if (is_Conv(left) &&
is_Const(right) &&
tarval_is_null(get_Const_tarval(right))) {
ir_mode* mode = get_irn_mode(left);
ir_node* op = get_Conv_op(left);
ir_mode* op_mode = get_irn_mode(op);
if (get_mode_size_bits(mode) > get_mode_size_bits(op_mode) &&
(mode_is_signed(mode) || !mode_is_signed(op_mode))) {
ir_node *null = new_Const(op_mode, get_mode_null(op_mode));
dbg_info *dbg = get_irn_dbg_info(n);
ir_graph *irg = current_ir_graph;
ir_node *block = get_nodes_block(n);
return new_rd_Cmp(dbg, irg, block, op, null);
}
}
/* remove Casts */
if (is_Cast(left))
left = get_Cast_op(left);
......@@ -3511,7 +3529,6 @@ static ir_node *transform_node_Proj_Cmp(ir_node *proj) {
default:
break;
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment