ok for google branch for now. Please resubmit to trunk and backport the trunk version if needed.
thanks, David On Tue, Feb 11, 2014 at 10:29 AM, Wei Mi <w...@google.com> wrote: >>> +/* Return true if the use is defined by a gcov counter var. >>> + It is used to check if an iv candidate is generated for >>> + profiling. For profile generated ssa name, we should not >>> + use it as IV because gcov counter may have data-race for >>> + multithread program, it could involve tricky bug to use >>> + such ssa var in IVOPT. >>> + >> >> Add the snippets describing how ralloc introduces a second gcov >> counter load and asynchronous update of it from another thread leading >> to bogus trip count. >> >> Also mention that setting volatile flag on gcov counter accesses may >> greatly degrade profile-gen performance. >> > > Comments added. > >>> + if (!is_gimple_assign (stmt)) >>> + return false; >>> + >>> + rhs = gimple_assign_rhs1 (stmt); >>> + if (TREE_CODE (rhs) != ARRAY_REF) >>> + return false; >>> + >>> + decl = TREE_OPERAND (rhs, 0); >>> + if (TREE_CODE (decl) != VAR_DECL) >>> + return false; >> >> >> >> Also check TREE_STATIC and DECL_ARTIFICIAL flag. >> >> >> David >> > > Check added. Add DECL_ARTIFICIAL setting in build_var() in coverage.c. > > The updated patch is attached. > > Thanks, > Wei.