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

Davide Italiano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 20 12:56:17 PDT 2017


davide added a comment.

Looks okay, my POSIX was rusty so I looked at it again and this seems OK to speculate as it has no side-effects.
The thread id is guaranteed to be unique across all *running* threads, but can be reused when a threads joins and another one is created. I don't think this matters for this optimization.
I looked very closely at the opengroup spec and I can't find a paragraph stating that the return of pthread_self() is guaranteed to be unique for the thread lifetime.
I expect any sane implementation to do that, and it's probably implicit.


https://reviews.llvm.org/D32782





More information about the llvm-commits mailing list