summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorXin Tong <trent.xin.tong@gmail.com>2017-05-20 22:40:25 +0000
committerXin Tong <trent.xin.tong@gmail.com>2017-05-20 22:40:25 +0000
commit75af3af95780e1c379409bf56c516a272c4fa961 (patch)
treedf81d93ee10bd76a5be14744ff2ef967f0ddfeb8 /llvm/lib/Analysis
parent36af8f4d42a0d4c5191450f5b729749b56bcc0e7 (diff)
downloadbcm5719-llvm-75af3af95780e1c379409bf56c516a272c4fa961.tar.gz
bcm5719-llvm-75af3af95780e1c379409bf56c516a272c4fa961.zip
Add pthread_self function prototype and make it speculatable.
Summary: This allows pthread_self to be pulled out of a loop by LICM. Reviewers: hfinkel, arsenm, davide Reviewed By: davide Subscribers: davide, wdng, llvm-commits Differential Revision: https://reviews.llvm.org/D32782 llvm-svn: 303495
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/TargetLibraryInfo.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp
index 2be5d5caf7c..b12778278ce 100644
--- a/llvm/lib/Analysis/TargetLibraryInfo.cpp
+++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp
@@ -349,6 +349,9 @@ static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T,
TLI.setUnavailable(LibFunc_atoll);
TLI.setUnavailable(LibFunc_frexpf);
TLI.setUnavailable(LibFunc_llabs);
+
+ // Win32 does *not* provide pthread_self.
+ TLI.setUnavailable(LibFunc_pthread_self);
}
switch (T.getOS()) {
@@ -1263,6 +1266,12 @@ bool TargetLibraryInfoImpl::isValidProtoForLibFunc(const FunctionType &FTy,
FTy.getParamType(0)->isPointerTy() &&
FTy.getParamType(1) == SizeTTy && FTy.getParamType(2) == SizeTTy);
+ // We do not attempt to match the return value here. i.e. thread identifiers
+ // should be considered opaque, for example, representation using either an
+ // arithmetic type or a structure is permitted.
+ case LibFunc_pthread_self:
+ return NumParams == 0;
+
case LibFunc_wcslen:
return (NumParams == 1 && FTy.getParamType(0)->isPointerTy() &&
FTy.getReturnType()->isIntegerTy());
OpenPOWER on IntegriCloud