diff options
| author | Kostya Serebryany <kcc@google.com> | 2012-02-06 22:48:56 +0000 |
|---|---|---|
| committer | Kostya Serebryany <kcc@google.com> | 2012-02-06 22:48:56 +0000 |
| commit | 9e0d377400058c1d82634b52bde5ccee17831531 (patch) | |
| tree | 01e7ef47763b20ac2378d926e706749bdd2455c0 /llvm/lib | |
| parent | 00a10caeb6e86bbfa9f8874efed8806f7e206e9f (diff) | |
| download | bcm5719-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.cpp | 8 |
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; |

