void **res;
ir_node *pred;
ir_graph *irg;
- int i, n = get_irn_arity(a);
+ int i, n;
+ if (get_nodes_block(a) != get_nodes_block(b))
+ return NULL;
+
+ n = get_irn_arity(a);
NEW_ARR_A(void *, res, n);
for (i = 0; i < n; ++i) {
if (mode == get_irn_mode(b)) {
ir_mode *ma, *mb;
-
- a = get_Conv_op(a);
- b = get_Conv_op(b);
+ ir_node *op_a = get_Conv_op(a);
+ ir_node *op_b = get_Conv_op(b);
/* check if it's allowed to skip the conv */
- ma = get_irn_mode(a);
- mb = get_irn_mode(b);
+ ma = get_irn_mode(op_a);
+ mb = get_irn_mode(op_b);
if (mode_is_reference(ma) && mode_is_reference(mb)) {
/* SubInt(ConvInt(aP), ConvInt(bP)) -> SubInt(aP,bP) */
+ a = op_a; b = op_b;
set_Sub_left(n, a);
set_Sub_right(n, b);
else if (is_Const(a) && is_const_Phi(b)) {
/* check for Div(Const, Phi) */
va = apply_binop_on_phi(b, get_Const_tarval(a), tarval_div, mode, 1);
- va = apply_binop_on_phi(b, get_Const_tarval(a), tarval_mod, mode, 1);
+ vb = apply_binop_on_phi(b, get_Const_tarval(a), tarval_mod, mode, 1);
if (va && vb) {
DBG_OPT_ALGSIM0(n, va, FS_OPT_CONST_PHI);
DBG_OPT_ALGSIM0(n, vb, FS_OPT_CONST_PHI);