Mark str[r]chr readonly.

llvm-svn: 98663
This commit is contained in:
Benjamin Kramer 2010-03-16 19:36:43 +00:00
parent 3a374da973
commit 5cf5fd2ffa
1 changed files with 10 additions and 1 deletions

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" ||