summaryrefslogtreecommitdiff
path: root/lib/Analysis/MemoryDependenceAnalysis.cpp
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
commit0ca032b03dc3a862670461651b3a950d1f14991b (patch)
treebb9ecc9629dede3d3e0a6f141a440a98399da14c /lib/Analysis/MemoryDependenceAnalysis.cpp
parent44ebf8b0331cb3a994a8df16fb63fdcdbc37d927 (diff)
downloadllvm-0ca032b03dc3a862670461651b3a950d1f14991b.tar.gz
llvm-0ca032b03dc3a862670461651b3a950d1f14991b.tar.bz2
llvm-0ca032b03dc3a862670461651b3a950d1f14991b.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149925 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/MemoryDependenceAnalysis.cpp')
-rw-r--r--lib/Analysis/MemoryDependenceAnalysis.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Analysis/MemoryDependenceAnalysis.cpp b/lib/Analysis/MemoryDependenceAnalysis.cpp
index 30f8d94698..cfaf2da6ce 100644
--- a/lib/Analysis/MemoryDependenceAnalysis.cpp
+++ b/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;