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

Mailing List "llvm-commits" via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 19 01:43:57 PDT 2018


llvm-commits added a subscriber: xiangzhai.
llvm-commits added a comment.

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").

> ================
>  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.

_______________________________________________

llvm-commits mailing list
llvm-commits at lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D49460





More information about the llvm-commits mailing list