On May 19, 2011, at 3:32 AM, Richard Sandiford wrote: > Paul Koning <paul_kon...@dell.com> writes: >> ... > >> 2. In the delay slot fill machinery (reorg.c), I don't see how a >> target can supply hooks to adjust the picking of one branch over >> another. In other words, if the architecture has branch-likely that >> has annul, but that instruction should not be used in a particular >> spot because the branch is in fact NOT likely, how would one do that? > > This isn't something that should be handled by target hooks. The way > that we record branch probabilities is target-independent, and reorg.c > already knows whether the target has both annulled and non-annulled > branches.
I saw that. But it looks to me like that logic picks one or the other depending on how that fills branch delay slots, and it does not take into account that the annulling branch on MIPS is supposed to be used (if at all) only when the branch is likely to be taken. In an example I ran into while chasing a wrong-code bug in 4.5.1, I saw a branch-likely instruction used where fall-through was far more likely (the branch was to an error path, and GCC knew it was unlikely) yet branch-likely was used anyway -- because of its annul property. For -Os that is fine, for -O1 is is not. paul