summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2013-12-05 15:03:02 +0000
committerKostya Serebryany <kcc@google.com>2013-12-05 15:03:02 +0000
commit2460c3fc733a618c65a032065f9e45a2232b2e3e (patch)
treea2a8d2bd272709adae7cbe45ad9085bdbc3c87b4 /llvm/lib
parent5ca3de6e91fb32ff71c90d3af25cfcbb538a49c3 (diff)
downloadbcm5719-llvm-2460c3fc733a618c65a032065f9e45a2232b2e3e.tar.gz
bcm5719-llvm-2460c3fc733a618c65a032065f9e45a2232b2e3e.zip
[tsan] fix PR18146: sometimes a variable written into vptr could have an integer type (after other optimizations)
llvm-svn: 196507
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
index baec1534e00..5c188178200 100644
--- a/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
@@ -408,10 +408,12 @@ bool ThreadSanitizer::instrumentLoadOrStore(Instruction *I) {
if (isa<VectorType>(StoredValue->getType()))
StoredValue = IRB.CreateExtractElement(
StoredValue, ConstantInt::get(IRB.getInt32Ty(), 0));
+ if (StoredValue->getType()->isIntegerTy())
+ StoredValue = IRB.CreateIntToPtr(StoredValue, IRB.getInt8PtrTy());
// Call TsanVptrUpdate.
IRB.CreateCall2(TsanVptrUpdate,
IRB.CreatePointerCast(Addr, IRB.getInt8PtrTy()),
- IRB.CreateBitCast(StoredValue, IRB.getInt8PtrTy()));
+ IRB.CreatePointerCast(StoredValue, IRB.getInt8PtrTy()));
NumInstrumentedVtableWrites++;
return true;
}
OpenPOWER on IntegriCloud