[PATCH] D32782: Add pthread_self function prototype and make it speculatable.
Xin Tong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 3 09:21:18 PDT 2017
trentxintong added inline comments.
================
Comment at: lib/Analysis/TargetLibraryInfo.cpp:1182-1184
+ case LibFunc_pthread_self:
+ return NumParams == 0 && FTy.getReturnType()->isIntegerTy();
+
----------------
davide wrote:
> I'm not entirely sure about this bit.
> IIRC POSIX specifies thread ids to be opaque, see:
>
> ```
> Thread identifiers should be considered opaque: any attempt to use a
> thread ID other than in pthreads calls is nonportable and can lead to
> unspecified results.
> ```
>
> so this assumption of it being an integer type might not hold.
Yes, I am a bit ambivalent on this as well when i wrote the patch.
We find library functions by matching its name and its specific function signature. I guess I could leave out the check for the argument here as its opaque and may vary from platform to platform.
There is a test case in unittest I need to fix if we do this.
https://reviews.llvm.org/D32782
More information about the llvm-commits
mailing list