diff options
author | Kostya Serebryany <kcc@google.com> | 2013-11-21 07:29:28 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2013-11-21 07:29:28 +0000 |
commit | 42a9da35b839b3a2bb0c891ecc7e138da016f1dd (patch) | |
tree | 3f6d9220650abb6067aa54caf06602a750fe1aa8 /lib/Analysis | |
parent | 072ebe59e2b05af9e67a691163273b9ab2b96b3b (diff) | |
download | llvm-42a9da35b839b3a2bb0c891ecc7e138da016f1dd.tar.gz llvm-42a9da35b839b3a2bb0c891ecc7e138da016f1dd.tar.bz2 llvm-42a9da35b839b3a2bb0c891ecc7e138da016f1dd.tar.xz |
Don't speculate loads under ThreadSanitizer
Summary:
Don't speculate loads under ThreadSanitizer.
This fixes https://code.google.com/p/thread-sanitizer/issues/detail?id=40
Also discussed here: http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-November/067929.html
Reviewers: chandlerc
Reviewed By: chandlerc
CC: llvm-commits, dvyukov
Differential Revision: http://llvm-reviews.chandlerc.com/D2227
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195324 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/ValueTracking.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp index e39ee628ff..803051d0bb 100644 --- a/lib/Analysis/ValueTracking.cpp +++ b/lib/Analysis/ValueTracking.cpp @@ -2006,7 +2006,9 @@ bool llvm::isSafeToSpeculativelyExecute(const Value *V, } case Instruction::Load: { const LoadInst *LI = cast<LoadInst>(Inst); - if (!LI->isUnordered()) + if (!LI->isUnordered() || + // Speculative load may create a race that did not exist in the source. + LI->getParent()->getParent()->hasFnAttribute(Attribute::SanitizeThread)) return false; return LI->getPointerOperand()->isDereferenceablePointer(); } |