diff options
author | Kostya Serebryany <kcc@google.com> | 2012-07-05 09:07:31 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2012-07-05 09:07:31 +0000 |
commit | 4a002ab9c3eb19d33641cf37945a2ed153ee6d77 (patch) | |
tree | b2beac7a053b11d4867634c0a303eedf3c82134a /lib/Transforms/Instrumentation/ThreadSanitizer.cpp | |
parent | 7a7a6db6d79b53fdf01bbd9519e669424c3ea7a0 (diff) | |
download | external_llvm-4a002ab9c3eb19d33641cf37945a2ed153ee6d77.zip external_llvm-4a002ab9c3eb19d33641cf37945a2ed153ee6d77.tar.gz external_llvm-4a002ab9c3eb19d33641cf37945a2ed153ee6d77.tar.bz2 |
[tsan] fix compile-time falilure found while building Chromium with tsan (tsan issue #3). A unit test will follow separately.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159736 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Instrumentation/ThreadSanitizer.cpp')
-rw-r--r-- | lib/Transforms/Instrumentation/ThreadSanitizer.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Transforms/Instrumentation/ThreadSanitizer.cpp b/lib/Transforms/Instrumentation/ThreadSanitizer.cpp index 4c12a9b..dc0fa71 100644 --- a/lib/Transforms/Instrumentation/ThreadSanitizer.cpp +++ b/lib/Transforms/Instrumentation/ThreadSanitizer.cpp @@ -319,7 +319,12 @@ bool ThreadSanitizer::instrumentLoadOrStore(Instruction *I) { if (Idx < 0) return false; if (IsWrite && isVtableAccess(I)) { + DEBUG(dbgs() << " VPTR : " << *I << "\n"); Value *StoredValue = cast<StoreInst>(I)->getValueOperand(); + // StoredValue does not necessary have a pointer type. + if (isa<IntegerType>(StoredValue->getType())) + StoredValue = IRB.CreateIntToPtr(StoredValue, IRB.getInt8PtrTy()); + // Call TsanVptrUpdate. IRB.CreateCall2(TsanVptrUpdate, IRB.CreatePointerCast(Addr, IRB.getInt8PtrTy()), IRB.CreatePointerCast(StoredValue, IRB.getInt8PtrTy())); |