Mark strto* as readonly when the endptr is null.
llvm-svn: 64460
diff --git a/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp
index fed239e..c199f30 100644
--- a/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp
+++ b/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp
@@ -733,8 +733,10 @@
return 0;
Value *EndPtr = CI->getOperand(2);
- if (isa<ConstantPointerNull>(EndPtr))
+ if (isa<ConstantPointerNull>(EndPtr)) {
+ CI->setOnlyReadsMemory();
CI->addAttribute(1, Attribute::NoCapture);
+ }
return 0;
}