On Fri, Jul 27, 2012 at 11:08 AM, Steven Bosscher <stevenb....@gmail.com> wrote: > On Fri, Jul 27, 2012 at 10:57 AM, Richard Guenther > <richard.guent...@gmail.com> wrote: >> On Thu, Jul 26, 2012 at 11:58 PM, Richard Henderson <r...@redhat.com> wrote: >>> On 07/26/2012 02:41 PM, Richard Henderson wrote: >>>> This is a patch... >>> >>> ... that I should have attached. Bah. >> >> Do we need to mark the labels so we preserve them? Consider >> >> goto foo; >> >> foo: >> bar __attribute__((cold)): >> ... >> >> so bar will be unused? What about BB merging if we end up with >> >> <BB 3>: >> .. >> fallthru >> bar __attribute__((cold)): >> ... >> >> should BB 3 inherit the coldness? I think we no longer disable >> BB merging if the destination has user labels. > > Right. I don't like the use of this attribute on labels at all, for > the reasons you list here. I think it would be much cleaner to add a > branch hint on the label in the asm goto, to contain this extension > and to also to make it clear that it's not the label that is cold but > the jump that is unlikely to be executed (i.e. cause and effect: the > jump is unlikely and therefore the basic block is cold).
As in the case where you have both an unlikely and likely jump to a basic-block. But what I understand is that rth adds a way to mark a basic-block as hot or cold, not a way to mark an edge as hot or cold (that would be what the asm goto annotation would do). Both cases are of course useful. Richard. > Something like this: > > asm-goto-operands: > asm-got-branch-hint identifier > asm-goto-operands , asm-got-branch-hint identifier > > asm-got-branch-hint: <empty | + | -> > where + means branch-likely and - means branch-unlikely > > -> > > asm goto (""::::+l1); > asm goto (""::::+l1); > asm goto (""::::-l1); > Ciao! > Steven