diff options
author | Michael Gottesman <mgottesman@apple.com> | 2013-07-03 04:00:54 +0000 |
---|---|---|
committer | Michael Gottesman <mgottesman@apple.com> | 2013-07-03 04:00:54 +0000 |
commit | 7cb0321ad8d86c9fdfb70d3bfa1ff3e8e1ff9f71 (patch) | |
tree | d5b34fedfc6186717465cac0b080dca668f3604b /lib/Transforms/IPO/FunctionAttrs.cpp | |
parent | f0f85eab0469ac93f9bb6c7d19aca2c35868d83a (diff) | |
download | llvm-7cb0321ad8d86c9fdfb70d3bfa1ff3e8e1ff9f71.tar.gz llvm-7cb0321ad8d86c9fdfb70d3bfa1ff3e8e1ff9f71.tar.bz2 llvm-7cb0321ad8d86c9fdfb70d3bfa1ff3e8e1ff9f71.tar.xz |
Added support in FunctionAttrs for adding relevant function/argument attributes for the posix call gettimeofday.
This implies annotating it as nounwind and its arguments as nocapture. To be
conservative, we do not annotate the arguments with noalias since some platforms
do not have restrict on the declaration for gettimeofday.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185502 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/FunctionAttrs.cpp')
-rw-r--r-- | lib/Transforms/IPO/FunctionAttrs.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Transforms/IPO/FunctionAttrs.cpp b/lib/Transforms/IPO/FunctionAttrs.cpp index 79ce3c3305..7df556ebff 100644 --- a/lib/Transforms/IPO/FunctionAttrs.cpp +++ b/lib/Transforms/IPO/FunctionAttrs.cpp @@ -1310,6 +1310,16 @@ bool FunctionAttrs::inferPrototypeAttributes(Function &F) { // May throw; "open" is a valid pthread cancellation point. setDoesNotCapture(F, 1); break; + case LibFunc::gettimeofday: + if (FTy->getNumParams() != 2 || !FTy->getParamType(0)->isPointerTy() || + !FTy->getParamType(1)->isPointerTy()) + return false; + // Currently some platforms have the restrict keyword on the arguments to + // gettimeofday. To be conservative, do not add noalias to gettimeofday's + // arguments. + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + setDoesNotCapture(F, 2); default: // Didn't mark any attributes. return false; |