summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Analysis/TargetLibraryInfoTest.cpp
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/unittests/Analysis/TargetLibraryInfoTest.cpp
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/unittests/Analysis/TargetLibraryInfoTest.cpp')
-rw-r--r--llvm/unittests/Analysis/TargetLibraryInfoTest.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/unittests/Analysis/TargetLibraryInfoTest.cpp b/llvm/unittests/Analysis/TargetLibraryInfoTest.cpp
index 9d852cf0301..64a735de694 100644
--- a/llvm/unittests/Analysis/TargetLibraryInfoTest.cpp
+++ b/llvm/unittests/Analysis/TargetLibraryInfoTest.cpp
@@ -63,12 +63,13 @@ TEST_F(TargetLibraryInfoTest, InvalidProto) {
parseAssembly("%foo = type { %foo }\n");
auto *StructTy = M->getTypeByName("foo");
- auto *InvalidFTy = FunctionType::get(StructTy, /*isVarArg=*/false);
-
for (unsigned FI = 0; FI != LibFunc::NumLibFuncs; ++FI) {
LibFunc LF = (LibFunc)FI;
+ // Using the library function name to create a function that takes
+ // 1 parameter and returns the same type. There should be no library
+ // function that matches this egregiously incorrect prototypes.
auto *F = cast<Function>(
- M->getOrInsertFunction(TLI.getName(LF), InvalidFTy));
+ M->getOrInsertFunction(TLI.getName(LF), StructTy, StructTy));
EXPECT_FALSE(isLibFunc(F, LF));
}
}
@@ -246,6 +247,7 @@ TEST_F(TargetLibraryInfoTest, ValidProto) {
"declare float @powf(float, float)\n"
"declare x86_fp80 @powl(x86_fp80, x86_fp80)\n"
"declare i32 @printf(i8*, ...)\n"
+ "declare %struct @pthread_self()\n"
"declare i32 @putc(i32, %struct*)\n"
"declare i32 @putchar(i32)\n"
"declare i32 @puts(i8*)\n"
OpenPOWER on IntegriCloud