summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2012-02-06 22:48:56 +0000
committerKostya Serebryany <kcc@google.com>2012-02-06 22:48:56 +0000
commit9e0d377400058c1d82634b52bde5ccee17831531 (patch)
tree01e7ef47763b20ac2378d926e706749bdd2455c0 /llvm/lib
parent00a10caeb6e86bbfa9f8874efed8806f7e206e9f (diff)
downloadbcm5719-llvm-9e0d377400058c1d82634b52bde5ccee17831531.tar.gz
bcm5719-llvm-9e0d377400058c1d82634b52bde5ccee17831531.zip
The patch resolves the conflict between AddressSanitizer and load widening (GVN).
The problem initially reported by Mozilla folks (http://code.google.com/p/address-sanitizer/issues/detail?id=20), but it also prevents us from enabling LLVM bootstrap with AddressSanitizer. llvm-svn: 149925
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/MemoryDependenceAnalysis.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
index 30f8d94698f..cfaf2da6ce5 100644
--- a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
@@ -323,6 +323,14 @@ getLoadLoadClobberFullWidthSize(const Value *MemLocBase, int64_t MemLocOffs,
!TD.fitsInLegalInteger(NewLoadByteSize*8))
return 0;
+ if (LIOffs+NewLoadByteSize > MemLocEnd &&
+ LI->getParent()->getParent()->hasFnAttr(Attribute::AddressSafety)) {
+ // We will be reading past the location accessed by the original program.
+ // While this is safe in a regular build, Address Safety analysis tools
+ // may start reporting false warnings. So, don't do widening.
+ return 0;
+ }
+
// If a load of this width would include all of MemLoc, then we succeed.
if (LIOffs+NewLoadByteSize >= MemLocEnd)
return NewLoadByteSize;
OpenPOWER on IntegriCloud