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 | 0b458286e18d2661844d891c990e6c4a41668bd1 (patch) | |
| tree | a0f00dc4e71114ae1759b7e1d355b0fae52d1c07 /llvm/lib/Analysis/ValueTracking.cpp | |
| parent | a4bd9a0c0ed8287bd03937e9458ef9160aa675a0 (diff) | |
| download | bcm5719-llvm-0b458286e18d2661844d891c990e6c4a41668bd1.tar.gz bcm5719-llvm-0b458286e18d2661844d891c990e6c4a41668bd1.zip | |
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
llvm-svn: 195324
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
| -rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index e39ee628ff0..803051d0bb2 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/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(); } |

