1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

Mark str[r]chr readonly.

llvm-svn: 98663
This commit is contained in:
Benjamin Kramer 2010-03-16 19:36:43 +00:00
parent faade5305c
commit 4b48f8274f

View File

@ -1400,6 +1400,15 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
setOnlyReadsMemory(F);
setDoesNotThrow(F);
setDoesNotCapture(F, 1);
} else if (Name == "strchr" ||
Name == "strrchr") {
if (FTy->getNumParams() != 2 ||
!FTy->getParamType(0)->isPointerTy() ||
!FTy->getParamType(1)->isIntegerTy())
continue;
setOnlyReadsMemory(F);
setDoesNotThrow(F);
setDoesNotCapture(F, 1);
} else if (Name == "strcpy" ||
Name == "stpcpy" ||
Name == "strcat" ||
@ -1428,7 +1437,7 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
} else if (Name == "strcmp" ||
Name == "strspn" ||
Name == "strncmp" ||
Name ==" strcspn" ||
Name == "strcspn" ||
Name == "strcoll" ||
Name == "strcasecmp" ||
Name == "strncasecmp") {