[GOOGLE] Avoid calling walk_aliased_vdefs in O0 function

Xinliang David Li davidxl@google.com
Tue Mar 24 04:33:00 GMT 2015


ok.

On Mon, Mar 23, 2015 at 5:37 PM, Carrot Wei <carrot@google.com> wrote:
> This patch fixes google internal bug b/19277289. It can only be
> reproduced in google 4.9 branch.
>
> In function param_change_prob, there is following function call
>
> walk_aliased_vdefs (&refd, gimple_vuse (stmt), record_modified, &info, NULL);
>
> If the source code is compiled with optimization, but cfun is compiled
> with -O0, gimple_vuse (stmt) can be null, and walk_aliased_vdefs will
> crash.
>
> Previously we didn't reach walk_aliased_vdefs because bb->frequency is
> 0, and following code always return early.
>
>       if (!bb->frequency)
>         return REG_BR_PROB_BASE;
>
> Dehao's patch r210989 propagates some non-zero value into
> bb->frequency, so now it doesn't return early and reaches the crash
> point.
>
> An obvious fix is skipping O0 functions in inline_generate_summary,
> but many other places will access data structures created in
> inline_analyze_function without check O0 for individual functions, and
> will crash. So this patch simply checks if O0 is specified then return
> early in function param_change_prob, same behavior as previous.
>
> Boot strapped on x86-64, passed regression test on x86-64 and arm.
>
> OK for google 4.9 branch?



More information about the Gcc-patches mailing list