diff options
author | Xin Tong <trent.xin.tong@gmail.com> | 2017-06-18 03:10:26 +0000 |
---|---|---|
committer | Xin Tong <trent.xin.tong@gmail.com> | 2017-06-18 03:10:26 +0000 |
commit | 9d2a5b1cf7f0f233e90650adcf1e1079b14a3cda (patch) | |
tree | ed4efd44b037153be4bd88b13ffa7274ca6b90ce /llvm/lib/Transforms | |
parent | 90e4c3f357f4d7a16d600407788cf5be51490579 (diff) | |
download | bcm5719-llvm-9d2a5b1cf7f0f233e90650adcf1e1079b14a3cda.tar.gz bcm5719-llvm-9d2a5b1cf7f0f233e90650adcf1e1079b14a3cda.zip |
Add argmononly attribute to strlen and wcslen, i.e. they only read memory (string) passed to them.
Summary:
This allows strlen to be moved out of the loop in case its argument is
not modified in the loop in LICM.
Reviewers: hfinkel, davide, sanjoy, dberlin
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D34323
llvm-svn: 305641
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Utils/BuildLibCalls.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp index ebde1f9a17d..b60dfb4f354 100644 --- a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp +++ b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp @@ -116,6 +116,7 @@ bool llvm::inferLibFuncAttributes(Function &F, const TargetLibraryInfo &TLI) { case LibFunc_wcslen: Changed |= setOnlyReadsMemory(F); Changed |= setDoesNotThrow(F); + Changed |= setOnlyAccessesArgMemory(F); Changed |= setDoesNotCapture(F, 0); return Changed; case LibFunc_strchr: |