[PATCH] D32782: Add pthread_self function prototype and make it speculatable.

Xin Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 20 01:23:53 PDT 2017


trentxintong added a comment.

I have an internal synthetic benchmark which is not very interesting. But I imagine its not difficult to come up with a case which a function calls pthread_self on entry and the function is called within a loop. After inlining, the pthread_self is called inside the loop.

BENCHMARK(pthread_self, n) {

  for (int i = 0; i < n; i++) {
    auto id = pthread_self();
    folly::doNotOptimizeAway(id);
  }

}


https://reviews.llvm.org/D32782





More information about the llvm-commits mailing list