Mark strto* as readonly when the endptr is null.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64460 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/SimplifyLibCalls.cpp b/lib/Transforms/Scalar/SimplifyLibCalls.cpp
index fed239e..c199f30 100644
--- a/lib/Transforms/Scalar/SimplifyLibCalls.cpp
+++ b/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;
   }