1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00

[tsan] fix PR18146: sometimes a variable written into vptr could have an integer type (after other optimizations)

llvm-svn: 196507
This commit is contained in:
Kostya Serebryany 2013-12-05 15:03:02 +00:00
parent 925169cb4e
commit eb57b3e248
2 changed files with 13 additions and 1 deletions

View File

@ -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;
}

View File

@ -11,6 +11,16 @@ entry:
ret void
}
define void @FooInt(i64* nocapture %a, i64 %b) nounwind uwtable sanitize_thread {
entry:
; CHECK-LABEL: @FooInt
; CHECK: call void @__tsan_vptr_update
; CHECK: ret void
store i64 %b, i64* %a, align 8, !tbaa !0
ret void
}
declare i32 @Func1()
declare i32 @Func2()