[PATCH] D28460: getLoopEstimatedTripCount should really be called getLoopEstimatedBackedgeTakeCount.

Xin Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 11:01:43 PST 2017


trentxintong added a comment.

In https://reviews.llvm.org/D28460#639950, @danielcdh wrote:

> 1. cat b.cc int bar(int);
>
>   void foo(int a) { while (a) { a = bar(a); } }
>
>   #cat c.cc void foo(int);
>
>   int bar(int x) { return x - 1; }
>
>   int main() { foo(5); return 0; }
>
>   #clang  -O2 -fprofile-generate=prof.raw b.cc c.cc -o instr_bin #llvm-profdata merge prof.raw -o prof #clang b.cc -c -O2 -fprofile-use=prof -emit-llvm #opt -S b.bc |grep branch_weights !29 = !{!"branch_weights", i32 1, i32 5}
>
>   Looks like (5 + 1/2) / 1 = 5 is the correct trip count?


Thanks for the example, I will use it to take a look.


https://reviews.llvm.org/D28460





More information about the llvm-commits mailing list