As Jakub says in the PR, the fix for PR 46309 indirectly depends on BRANCH_COST, and the PR is still open because of that. For the time being, it seems better to avoid the failure for MIPS targets by tuning for a processor with a high branch cost.
Tested on mips64-linux-gnu and applied. Richard gcc/testsuite/ * gcc.dg/pr46309.c: Add -mtune=octeon2 for MIPS. Index: gcc/testsuite/gcc.dg/pr46309.c =================================================================== --- gcc/testsuite/gcc.dg/pr46309.c 2011-12-31 11:12:38.000000000 +0000 +++ gcc/testsuite/gcc.dg/pr46309.c 2011-12-31 11:14:19.000000000 +0000 @@ -1,6 +1,9 @@ /* PR tree-optimization/46309 */ /* { dg-do compile } */ /* { dg-options "-O2 -fdump-tree-reassoc-details" } */ +/* The transformation depends on BRANCH_COST being greater than 1 + (see the notes in the PR), so try to force that. */ +/* { dg-additional-options "-mtune=octeon2" { target mips*-*-* } } */ int f1 (int a)