comparison lib/Transforms/Instrumentation/ThreadSanitizer.cpp @ 33:e4204d083e25 LLVM3.5

LLVM 3.5
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Thu, 12 Dec 2013 14:32:10 +0900
parents 95c75e76d11b
children 54457678186b
comparison
equal deleted inserted replaced
1:f783a2dd24b1 33:e4204d083e25
400 if (Idx < 0) 400 if (Idx < 0)
401 return false; 401 return false;
402 if (IsWrite && isVtableAccess(I)) { 402 if (IsWrite && isVtableAccess(I)) {
403 DEBUG(dbgs() << " VPTR : " << *I << "\n"); 403 DEBUG(dbgs() << " VPTR : " << *I << "\n");
404 Value *StoredValue = cast<StoreInst>(I)->getValueOperand(); 404 Value *StoredValue = cast<StoreInst>(I)->getValueOperand();
405 // StoredValue does not necessary have a pointer type. 405 // StoredValue may be a vector type if we are storing several vptrs at once.
406 if (isa<IntegerType>(StoredValue->getType())) 406 // In this case, just take the first element of the vector since this is
407 // enough to find vptr races.
408 if (isa<VectorType>(StoredValue->getType()))
409 StoredValue = IRB.CreateExtractElement(
410 StoredValue, ConstantInt::get(IRB.getInt32Ty(), 0));
411 if (StoredValue->getType()->isIntegerTy())
407 StoredValue = IRB.CreateIntToPtr(StoredValue, IRB.getInt8PtrTy()); 412 StoredValue = IRB.CreateIntToPtr(StoredValue, IRB.getInt8PtrTy());
408 // Call TsanVptrUpdate. 413 // Call TsanVptrUpdate.
409 IRB.CreateCall2(TsanVptrUpdate, 414 IRB.CreateCall2(TsanVptrUpdate,
410 IRB.CreatePointerCast(Addr, IRB.getInt8PtrTy()), 415 IRB.CreatePointerCast(Addr, IRB.getInt8PtrTy()),
411 IRB.CreatePointerCast(StoredValue, IRB.getInt8PtrTy())); 416 IRB.CreatePointerCast(StoredValue, IRB.getInt8PtrTy()));