summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorFilipe Cabecinhas <me@filcab.net>2016-12-14 21:57:04 +0000
committerFilipe Cabecinhas <me@filcab.net>2016-12-14 21:57:04 +0000
commitdd9688703c0c4df836d0b1ad0d93ccad33c00d2e (patch)
treef4c11a966c2046c4071c91239654960aa394fd75 /llvm/lib/Transforms
parent1e69017a6d5b3eb136de847eeb52058f3d6df088 (diff)
downloadbcm5719-llvm-dd9688703c0c4df836d0b1ad0d93ccad33c00d2e.tar.gz
bcm5719-llvm-dd9688703c0c4df836d0b1ad0d93ccad33c00d2e.zip
[asan] Don't skip instrumentation of masked load/store unless we've seen a full load/store on that pointer.
Reviewers: kcc, RKSimon Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D27625 llvm-svn: 289718
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index 633df4f3b3a..acc13aaeaf4 100644
--- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -2066,11 +2066,20 @@ bool AddressSanitizer::runOnFunction(Function &F) {
int NumInsnsPerBB = 0;
for (auto &Inst : BB) {
if (LooksLikeCodeInBug11395(&Inst)) return false;
+ Value *MaybeMask = nullptr;
if (Value *Addr = isInterestingMemoryAccess(&Inst, &IsWrite, &TypeSize,
- &Alignment)) {
+ &Alignment, &MaybeMask)) {
if (ClOpt && ClOptSameTemp) {
- if (!TempsToInstrument.insert(Addr).second)
- continue; // We've seen this temp in the current BB.
+ // If we have a mask, skip instrumentation if we've already
+ // instrumented the full object. But don't add to TempsToInstrument
+ // because we might get another load/store with a different mask.
+ if (MaybeMask) {
+ if (TempsToInstrument.count(Addr))
+ continue; // We've seen this (whole) temp in the current BB.
+ } else {
+ if (!TempsToInstrument.insert(Addr).second)
+ continue; // We've seen this temp in the current BB.
+ }
}
} else if (ClInvalidPointerPairs &&
isInterestingPointerComparisonOrSubtraction(&Inst)) {
OpenPOWER on IntegriCloud