summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-12-17 01:09:43 +0000
committerDan Gohman <gohman@apple.com>2010-12-17 01:09:43 +0000
commit93dc2b808f533e5947cf1d4ccf416a242ab6853a (patch)
tree52bb7f7914979e99de2302093faf526f4de8a252 /llvm/lib/Transforms
parentf89156da92653a827017d3d24528531561df3685 (diff)
downloadbcm5719-llvm-93dc2b808f533e5947cf1d4ccf416a242ab6853a.tar.gz
bcm5719-llvm-93dc2b808f533e5947cf1d4ccf416a242ab6853a.zip
Revert r64460. strtol and friends cannot be marked readonly, even with
a null endptr argument, because they may write to errno. This fixes a seflhost miscompile observed on Linux targets when TBAA was enabled. llvm-svn: 122014
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp
index 43c6f6dda25..3edc447cec1 100644
--- a/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp
+++ b/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp
@@ -577,7 +577,8 @@ struct StrToOpt : public LibCallOptimization {
Value *EndPtr = CI->getArgOperand(1);
if (isa<ConstantPointerNull>(EndPtr)) {
- CI->setOnlyReadsMemory();
+ // With a null EndPtr, this function won't capture the main argument.
+ // It would be readonly too, except that it still may write to errno.
CI->addAttribute(1, Attribute::NoCapture);
}
OpenPOWER on IntegriCloud