On 07/27/2012 01:57 AM, Richard Guenther wrote:
> On Thu, Jul 26, 2012 at 11:58 PM, Richard Henderson <[email protected]> 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?
We don't purge unused labels until rtl (at which point it becomes a deleted
label note), and we only really need the label to survive until after the
profile_estimate pass. After which all the significance of the label has been
transferred into the edge frequency.
The test case
void g(void);
void h(void);
void f(int x, int y)
{
if (x) goto A;
return;
A:
B: __attribute__((cold))
g();
return;
}
does in fact DTRT with the estimates.
> 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.
The edge might be marked cold, but that should have no other effect. No more
than
if (__builtin_expect (test, 0))
when it turns out that we can prove that test is false.
r~