[PATCH] D88335: [BuildLibCalls] Add noalias for strcat and stpcpy
Dávid Bolvanský via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 27 12:39:09 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG155ac333945d: [BuildLibCalls] Add noalias for strcat and stpcpy (authored by xbolva00).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D88335/new/
https://reviews.llvm.org/D88335
Files:
llvm/lib/Transforms/Utils/BuildLibCalls.cpp
llvm/test/Transforms/InferFunctionAttrs/annotate.ll
Index: llvm/test/Transforms/InferFunctionAttrs/annotate.ll
===================================================================
--- llvm/test/Transforms/InferFunctionAttrs/annotate.ll
+++ llvm/test/Transforms/InferFunctionAttrs/annotate.ll
@@ -825,16 +825,16 @@
; CHECK-LINUX: declare noundef i32 @statvfs64(i8* nocapture noundef readonly, %opaque* nocapture noundef) [[G1]]
declare i32 @statvfs64(i8*, %opaque*)
-; CHECK: declare i8* @stpcpy(i8*, i8* nocapture readonly) [[G1]]
+; CHECK: declare i8* @stpcpy(i8* noalias, i8* noalias nocapture readonly) [[G1]]
declare i8* @stpcpy(i8*, i8*)
-; CHECK: declare i8* @stpncpy(i8*, i8* nocapture readonly, i64) [[G1]]
+; CHECK: declare i8* @stpncpy(i8* noalias, i8* noalias nocapture readonly, i64) [[G1]]
declare i8* @stpncpy(i8*, i8*, i64)
; CHECK: declare i32 @strcasecmp(i8* nocapture, i8* nocapture) [[G2]]
declare i32 @strcasecmp(i8*, i8*)
-; CHECK: declare i8* @strcat(i8* returned, i8* nocapture readonly) [[G1]]
+; CHECK: declare i8* @strcat(i8* noalias returned, i8* noalias nocapture readonly) [[G1]]
declare i8* @strcat(i8*, i8*)
; CHECK: declare i8* @strchr(i8*, i32) [[ARGMEMONLY_NOFREE_NOUNWIND_READONLY]]
@@ -861,7 +861,7 @@
; CHECK: declare i32 @strncasecmp(i8* nocapture, i8* nocapture, i64) [[G2]]
declare i32 @strncasecmp(i8*, i8*, i64)
-; CHECK: declare i8* @strncat(i8* returned, i8* nocapture readonly, i64) [[G1]]
+; CHECK: declare i8* @strncat(i8* noalias returned, i8* noalias nocapture readonly, i64) [[G1]]
declare i8* @strncat(i8*, i8*, i64)
; CHECK: declare i32 @strncmp(i8* nocapture, i8* nocapture, i64) [[ARGMEMONLY_NOFREE_NOUNWIND_READONLY]]
Index: llvm/lib/Transforms/Utils/BuildLibCalls.cpp
===================================================================
--- llvm/lib/Transforms/Utils/BuildLibCalls.cpp
+++ llvm/lib/Transforms/Utils/BuildLibCalls.cpp
@@ -203,9 +203,6 @@
return Changed;
case LibFunc_strcpy:
case LibFunc_strncpy:
- Changed |= setDoesNotAlias(F, 0);
- Changed |= setDoesNotAlias(F, 1);
- LLVM_FALLTHROUGH;
case LibFunc_strcat:
case LibFunc_strncat:
Changed |= setReturnedArg(F, 0);
@@ -215,6 +212,8 @@
Changed |= setDoesNotThrow(F);
Changed |= setDoesNotCapture(F, 1);
Changed |= setOnlyReadsMemory(F, 1);
+ Changed |= setDoesNotAlias(F, 0);
+ Changed |= setDoesNotAlias(F, 1);
return Changed;
case LibFunc_strxfrm:
Changed |= setDoesNotThrow(F);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88335.294563.patch
Type: text/x-patch
Size: 2438 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200927/703ecc1f/attachment.bin>
More information about the llvm-commits
mailing list