http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57393
--- Comment #15 from Marek Polacek <mpolacek at gcc dot gnu.org> --- The fix am about to test (optimize_range_tests can change the ranks...) --- gcc/tree-ssa-reassoc.c.mp 2013-08-20 13:40:45.478290165 +0200 +++ gcc/tree-ssa-reassoc.c 2013-08-20 13:41:00.428348680 +0200 @@ -4237,6 +4237,9 @@ reassociate_bb (basic_block bb) if (TREE_CODE (lhs) == SSA_NAME && has_zero_uses (lhs)) continue; + if (rhs_code == BIT_IOR_EXPR || rhs_code == BIT_AND_EXPR) + optimize_range_tests (rhs_code, &ops); + gimple_set_visited (stmt, true); linearize_expr_tree (&ops, stmt, true, true); ops.qsort (sort_by_operand_rank); @@ -4248,9 +4251,6 @@ reassociate_bb (basic_block bb) optimize_ops_list (rhs_code, &ops); } - if (rhs_code == BIT_IOR_EXPR || rhs_code == BIT_AND_EXPR) - optimize_range_tests (rhs_code, &ops); - if (first_pass_instance && rhs_code == MULT_EXPR && flag_unsafe_math_optimizations)