[PATCH] D49460: Flush counters before forking to avoid counting the execution before fork twice

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 19 10:15:49 PDT 2018


On Thu, Jul 19, 2018 at 1:43 AM Marco Castelluccio <
mcastelluccio at mozilla.com> wrote:

> Il 18/07/2018 20:52, David Li via Phabricator ha scritto:
>
> > davidxl added inline comments.
> >
> >
> > ================
> > Comment at: test/profile/Inputs/instrprof-gcov-fork.c.gcov:9
> > +// CHECK-NEXT:function func1 called 1 returned 100% blocks executed 100%
> > +// CHECK-NEXT:        2:    3:void func1() {}
> > +// CHECK-NEXT:function func2 called 2 returned 100% blocks executed 100%
> > ----------------
> > func1 is executed once not twice.
> This is a pre-existing problem
> (https://bugs.llvm.org/show_bug.cgi?id=38065), but you can see that
> after the patch it is actually executed once ("called 1").
>
>
why is the entry count shows 2 here? This looks like a different issue
though.



> >
> >
> > ================
> > Comment at: test/profile/Inputs/instrprof-gcov-fork.c.gcov:11
> > +// CHECK-NEXT:function func2 called 2 returned 100% blocks executed 100%
> > +// CHECK-NEXT:        4:    4:void func2() {}
> > +// CHECK-NEXT:        -:    5:
> > ----------------
> > func2 is executed twice not 4 times.
> Same here.
>
>
> >
> >
> > ================
> > Comment at: test/profile/Inputs/instrprof-gcov-fork.c.gcov:20
> > +// CHECK-NEXT:        -:   11:
> > +// CHECK-NEXT:        1:   12:  func2();
> > +// CHECK-NEXT:        -:   13:
> > ----------------
> > this line should be executed twice.
> >
> >
> > ================
> > Comment at: test/profile/Inputs/instrprof-gcov-fork.c.gcov:22
> > +// CHECK-NEXT:        -:   13:
> > +// CHECK-NEXT:        1:   14:  return 0;
> > +// CHECK-NEXT:        -:   15:}
> > ----------------
> > same here.
> > davidxl added a comment.
> >
> > One of the real issues is that func1, fork, and func2 are in the same BB
> and share the same profile counter. The BB ending with fork should be split
> so that func2 's block has its own counter.
>
> Exactly, these are due to the problem I mentioned in the summary, which
> probably has to be fixed in the Clang/LLVM side.
> I think they are unrelated problems though, this patch is going to fix
> the double counting, the other patch would fix the BBs in the function
> which calls fork.
>


Ok.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180719/fe3af909/attachment.html>


More information about the llvm-commits mailing list