aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
diff options
context:
space:
mode:
authorDaniel Woodworth <daniel.woodworth@intel.com>2023-04-19 15:23:57 -0400
committerJoshua Cranmer <joshua.cranmer@intel.com>2023-04-19 15:24:45 -0400
commit750e20e1713cbf51fb622804b4162e51844f52e0 (patch)
tree4a89d18702cf86c4a41743061bfd171727ca5d93 /llvm/lib/Transforms/Utils/BuildLibCalls.cpp
parenta37a6218f8a029093cc439928d5cce67ccf133de (diff)
downloadllvm-750e20e1713cbf51fb622804b4162e51844f52e0.zip
llvm-750e20e1713cbf51fb622804b4162e51844f52e0.tar.gz
llvm-750e20e1713cbf51fb622804b4162e51844f52e0.tar.bz2
[InferAttrs] Mark frexp and modf as memory(argmem: write)
These two math library functions can't write to errno, but they do produce two results and store the second result to a pointer passed as their second argument. Appropriately marking them as memory(argmem: write) enables more optimizations on calls to them. Reviewed By: xbolva00 Differential Revision: https://reviews.llvm.org/D148043
Diffstat (limited to 'llvm/lib/Transforms/Utils/BuildLibCalls.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/BuildLibCalls.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
index 1e21a2f..6adf2e6 100644
--- a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
@@ -478,6 +478,8 @@ bool llvm::inferNonMandatoryLibFuncAttrs(Function &F,
case LibFunc_modfl:
Changed |= setDoesNotThrow(F);
Changed |= setWillReturn(F);
+ Changed |= setOnlyAccessesArgMemory(F);
+ Changed |= setOnlyWritesMemory(F);
Changed |= setDoesNotCapture(F, 1);
break;
case LibFunc_memcpy:
@@ -725,6 +727,8 @@ bool llvm::inferNonMandatoryLibFuncAttrs(Function &F,
case LibFunc_frexpl:
Changed |= setDoesNotThrow(F);
Changed |= setWillReturn(F);
+ Changed |= setOnlyAccessesArgMemory(F);
+ Changed |= setOnlyWritesMemory(F);
Changed |= setDoesNotCapture(F, 1);
break;
case LibFunc_fstatvfs: