From: Kostya Serebryany Date: Thu, 5 Jul 2012 09:07:31 +0000 (+0000) Subject: [tsan] fix compile-time falilure found while building Chromium with tsan (tsan issue... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=4a002ab9c3eb19d33641cf37945a2ed153ee6d77;p=oota-llvm.git [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 --- diff --git a/lib/Transforms/Instrumentation/ThreadSanitizer.cpp b/lib/Transforms/Instrumentation/ThreadSanitizer.cpp index 4c12a9b624c..dc0fa7175d9 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(I)->getValueOperand(); + // StoredValue does not necessary have a pointer type. + if (isa(StoredValue->getType())) + StoredValue = IRB.CreateIntToPtr(StoredValue, IRB.getInt8PtrTy()); + // Call TsanVptrUpdate. IRB.CreateCall2(TsanVptrUpdate, IRB.CreatePointerCast(Addr, IRB.getInt8PtrTy()), IRB.CreatePointerCast(StoredValue, IRB.getInt8PtrTy()));