This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[GOOGLE] Avoid calling walk_aliased_vdefs in O0 function


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?

Attachment: patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]