mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-03 15:26:18 +00:00
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
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user