From b3c9ba99bf6c3b14b3b69bac61a04fc8b968fce1 Mon Sep 17 00:00:00 2001 From: Ahmed Bougacha Date: Wed, 25 May 2016 21:16:33 +0000 Subject: [PATCH] [TLI] Also cover Linux 64 libfunc (stat64, ...) prototype checking. My script missed those in r270750. llvm-svn: 270763 --- lib/Analysis/TargetLibraryInfo.cpp | 4 +-- .../Transforms/InferFunctionAttrs/annotate.ll | 33 ++++++++++++++++++- .../Transforms/InferFunctionAttrs/no-proto.ll | 31 +++++++++++++++++ 3 files changed, 65 insertions(+), 3 deletions(-) diff --git a/lib/Analysis/TargetLibraryInfo.cpp b/lib/Analysis/TargetLibraryInfo.cpp index 2b5947f0320..925e7ce2d0d 100644 --- a/lib/Analysis/TargetLibraryInfo.cpp +++ b/lib/Analysis/TargetLibraryInfo.cpp @@ -697,8 +697,6 @@ bool TargetLibraryInfoImpl::isValidProtoForLibFunc(const FunctionType &FTy, case LibFunc::atol: case LibFunc::atoll: case LibFunc::ferror: - case LibFunc::fseeko64: - case LibFunc::ftello64: case LibFunc::getenv: case LibFunc::getpwnam: case LibFunc::pclose: @@ -724,9 +722,11 @@ bool TargetLibraryInfoImpl::isValidProtoForLibFunc(const FunctionType &FTy, case LibFunc::flockfile: case LibFunc::free: case LibFunc::fseek: + case LibFunc::fseeko64: case LibFunc::fseeko: case LibFunc::fsetpos: case LibFunc::ftell: + case LibFunc::ftello64: case LibFunc::ftello: case LibFunc::ftrylockfile: case LibFunc::funlockfile: diff --git a/test/Transforms/InferFunctionAttrs/annotate.ll b/test/Transforms/InferFunctionAttrs/annotate.ll index ed492ab626e..039114d0cb9 100644 --- a/test/Transforms/InferFunctionAttrs/annotate.ll +++ b/test/Transforms/InferFunctionAttrs/annotate.ll @@ -1,6 +1,7 @@ ; RUN: opt < %s -mtriple=x86_64-- -inferattrs -S | FileCheck %s ; RUN: opt < %s -mtriple=x86_64-- -passes=inferattrs -S | FileCheck %s -; RUN: opt < %s -mtriple=x86_64-apple-macosx10.8.0 -inferattrs -S | FileCheck -check-prefix=CHECK-DARWIN %s +; RUN: opt < %s -mtriple=x86_64-apple-macosx10.8.0 -inferattrs -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-DARWIN %s +; RUN: opt < %s -mtriple=x86_64-unknown-linux -inferattrs -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-LINUX %s ; RUN: opt < %s -mtriple=nvptx -inferattrs -S | FileCheck -check-prefix=CHECK-NVPTX %s ; operator new routines @@ -342,21 +343,33 @@ declare i32 @fseek(%opaque*, i64, i32) ; CHECK: declare i32 @fseeko(%opaque* nocapture, i64, i32) [[G0]] declare i32 @fseeko(%opaque*, i64, i32) +; CHECK-LINUX: declare i32 @fseeko64(%opaque* nocapture, i64, i32) [[G0]] +declare i32 @fseeko64(%opaque*, i64, i32) + ; CHECK: declare i32 @fsetpos(%opaque* nocapture, i64*) [[G0]] declare i32 @fsetpos(%opaque*, i64*) ; CHECK: declare i32 @fstat(i32, %opaque* nocapture) [[G0]] declare i32 @fstat(i32, %opaque*) +; CHECK-LINUX: declare i32 @fstat64(i32, %opaque* nocapture) [[G0]] +declare i32 @fstat64(i32, %opaque*) + ; CHECK: declare i32 @fstatvfs(i32, %opaque* nocapture) [[G0]] declare i32 @fstatvfs(i32, %opaque*) +; CHECK-LINUX: declare i32 @fstatvfs64(i32, %opaque* nocapture) [[G0]] +declare i32 @fstatvfs64(i32, %opaque*) + ; CHECK: declare i64 @ftell(%opaque* nocapture) [[G0]] declare i64 @ftell(%opaque*) ; CHECK: declare i64 @ftello(%opaque* nocapture) [[G0]] declare i64 @ftello(%opaque*) +; CHECK-LINUX: declare i64 @ftello64(%opaque* nocapture) [[G0]] +declare i64 @ftello64(%opaque*) + ; CHECK: declare i32 @ftrylockfile(%opaque* nocapture) [[G0]] declare i32 @ftrylockfile(%opaque*) @@ -465,9 +478,15 @@ declare x86_fp80 @logl(x86_fp80) ; CHECK: declare i32 @lstat(i8* nocapture readonly, %opaque* nocapture) [[G0]] declare i32 @lstat(i8*, %opaque*) +; CHECK-LINUX: declare i32 @lstat64(i8* nocapture readonly, %opaque* nocapture) [[G0]] +declare i32 @lstat64(i8*, %opaque*) + ; CHECK: declare noalias i8* @malloc(i64) [[G0]] declare i8* @malloc(i64) +; CHECK-LINUX: declare noalias i8* @memalign(i64, i64) +declare i8* @memalign(i64, i64) + ; CHECK: declare i8* @memccpy(i8*, i8* nocapture readonly, i32, i64) [[G0]] declare i8* @memccpy(i8*, i8*, i32, i64) @@ -513,6 +532,9 @@ declare x86_fp80 @nearbyintl(x86_fp80) ; CHECK: declare i32 @open(i8* nocapture readonly, i32, ...) declare i32 @open(i8*, i32, ...) +; CHECK-LINUX: declare i32 @open64(i8* nocapture readonly, i32, ...) +declare i32 @open64(i8*, i32, ...) + ; CHECK: declare noalias %opaque* @opendir(i8* nocapture readonly) [[G0]] declare %opaque* @opendir(i8*) @@ -654,9 +676,15 @@ declare i32 @sscanf(i8*, i8*, ...) ; CHECK: declare i32 @stat(i8* nocapture readonly, %opaque* nocapture) [[G0]] declare i32 @stat(i8*, %opaque*) +; CHECK-LINUX: declare i32 @stat64(i8* nocapture readonly, %opaque* nocapture) [[G0]] +declare i32 @stat64(i8*, %opaque*) + ; CHECK: declare i32 @statvfs(i8* nocapture readonly, %opaque* nocapture) [[G0]] declare i32 @statvfs(i8*, %opaque*) +; CHECK-LINUX: declare i32 @statvfs64(i8* nocapture readonly, %opaque* nocapture) [[G0]] +declare i32 @statvfs64(i8*, %opaque*) + ; CHECK: declare i8* @stpcpy(i8*, i8* nocapture readonly) [[G0]] declare i8* @stpcpy(i8*, i8*) @@ -777,6 +805,9 @@ declare i64 @times(%opaque*) ; CHECK: declare noalias %opaque* @tmpfile() [[G0]] declare %opaque* @tmpfile() +; CHECK-LINUX: declare noalias %opaque* @tmpfile64() [[G0]] +declare %opaque* @tmpfile64() + ; CHECK: declare i32 @toascii(i32) declare i32 @toascii(i32) diff --git a/test/Transforms/InferFunctionAttrs/no-proto.ll b/test/Transforms/InferFunctionAttrs/no-proto.ll index d847d7bef2f..256f5c356b8 100644 --- a/test/Transforms/InferFunctionAttrs/no-proto.ll +++ b/test/Transforms/InferFunctionAttrs/no-proto.ll @@ -1,3 +1,4 @@ +; RUN: opt < %s -mtriple=x86_64-unknown-linux -inferattrs -S | FileCheck %s ; RUN: opt < %s -mtriple=x86_64-apple-macosx10.8.0 -inferattrs -S | FileCheck %s ; Check that we don't modify libc functions with invalid prototypes. @@ -323,21 +324,33 @@ declare void @fseek(...) ; CHECK: declare void @fseeko(...) declare void @fseeko(...) +; CHECK: declare void @fseeko64(...) +declare void @fseeko64(...) + ; CHECK: declare void @fsetpos(...) declare void @fsetpos(...) ; CHECK: declare void @fstat(...) declare void @fstat(...) +; CHECK: declare void @fstat64(...) +declare void @fstat64(...) + ; CHECK: declare void @fstatvfs(...) declare void @fstatvfs(...) +; CHECK: declare void @fstatvfs64(...) +declare void @fstatvfs64(...) + ; CHECK: declare void @ftell(...) declare void @ftell(...) ; CHECK: declare void @ftello(...) declare void @ftello(...) +; CHECK: declare void @ftello64(...) +declare void @ftello64(...) + ; CHECK: declare void @ftrylockfile(...) declare void @ftrylockfile(...) @@ -446,9 +459,15 @@ declare void @logl(...) ; CHECK: declare void @lstat(...) declare void @lstat(...) +; CHECK: declare void @lstat64(...) +declare void @lstat64(...) + ; CHECK: declare void @malloc(...) declare void @malloc(...) +; CHECK: declare void @memalign(...) +declare void @memalign(...) + ; CHECK: declare void @memccpy(...) declare void @memccpy(...) @@ -497,6 +516,9 @@ declare void @nearbyintl(...) ; CHECK: declare void @open(...) declare void @open(...) +; CHECK: declare void @open64(...) +declare void @open64(...) + ; CHECK: declare void @opendir(...) declare void @opendir(...) @@ -638,9 +660,15 @@ declare void @sscanf(...) ; CHECK: declare void @stat(...) declare void @stat(...) +; CHECK: declare void @stat64(...) +declare void @stat64(...) + ; CHECK: declare void @statvfs(...) declare void @statvfs(...) +; CHECK: declare void @statvfs64(...) +declare void @statvfs64(...) + ; CHECK: declare void @stpcpy(...) declare void @stpcpy(...) @@ -761,6 +789,9 @@ declare void @times(...) ; CHECK: declare void @tmpfile(...) declare void @tmpfile(...) +; CHECK: declare void @tmpfile64(...) +declare void @tmpfile64(...) + ; CHECK: declare void @toascii(...) declare void @toascii(...)