if (!binrhsisreassoc)
{
- if (!try_special_add_to_ops (ops, rhscode, binrhs, binrhsdef))
+ bool swap = false;
+ if (try_special_add_to_ops (ops, rhscode, binrhs, binrhsdef))
+ /* If we add ops for the rhs we expect to be able to recurse
+ to it via the lhs during expression rewrite so swap
+ operands. */
+ swap = true;
+ else
add_to_ops_vec (ops, binrhs);
if (!try_special_add_to_ops (ops, rhscode, binlhs, binlhsdef))
add_to_ops_vec (ops, binlhs);
- return;
+ if (!swap)
+ return;
}
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " is now ");
print_gimple_stmt (dump_file, stmt, 0);
}
+ if (!binrhsisreassoc)
+ return;
/* We want to make it so the lhs is always the reassociative op,
so swap. */