[SanitizerCoverage] Fix a couple of typos. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236643 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alexey Samsonov
2015-05-06 21:35:25 +00:00
parent a414ba7844
commit d71e55b97f

View File

@@ -116,7 +116,7 @@ class SanitizerCoverageModule : public ModulePass {
ArrayRef<Instruction *> IndirCalls); ArrayRef<Instruction *> IndirCalls);
void InjectTraceForCmp(Function &F, ArrayRef<Instruction *> CmpTraceTargets); void InjectTraceForCmp(Function &F, ArrayRef<Instruction *> CmpTraceTargets);
bool InjectCoverage(Function &F, ArrayRef<BasicBlock *> AllBlocks); bool InjectCoverage(Function &F, ArrayRef<BasicBlock *> AllBlocks);
void SetNoSanitizeMetada(Instruction *I); void SetNoSanitizeMetadata(Instruction *I);
void InjectCoverageAtBlock(Function &F, BasicBlock &BB, bool UseCalls); void InjectCoverageAtBlock(Function &F, BasicBlock &BB, bool UseCalls);
unsigned NumberOfInstrumentedBlocks() { unsigned NumberOfInstrumentedBlocks() {
return SanCovFunction->getNumUses() + SanCovWithCheckFunction->getNumUses(); return SanCovFunction->getNumUses() + SanCovWithCheckFunction->getNumUses();
@@ -169,7 +169,7 @@ bool SanitizerCoverageModule::runOnModule(Module &M) {
kSanCovTraceCmp, VoidTy, Int64Ty, Int64Ty, Int64Ty, nullptr)); kSanCovTraceCmp, VoidTy, Int64Ty, Int64Ty, Int64Ty, nullptr));
SanCovModuleInit = checkSanitizerInterfaceFunction(M.getOrInsertFunction( SanCovModuleInit = checkSanitizerInterfaceFunction(M.getOrInsertFunction(
kSanCovModuleInitName, Type::getVoidTy(*C), Int32PtrTy, IntptrTy, kSanCovModuleInitName, VoidTy, Int32PtrTy, IntptrTy,
Int8PtrTy, Int8PtrTy, nullptr)); Int8PtrTy, Int8PtrTy, nullptr));
SanCovModuleInit->setLinkage(Function::ExternalLinkage); SanCovModuleInit->setLinkage(Function::ExternalLinkage);
// We insert an empty inline asm after cov callbacks to avoid callback merge. // We insert an empty inline asm after cov callbacks to avoid callback merge.
@@ -329,7 +329,7 @@ void SanitizerCoverageModule::InjectTraceForCmp(
Value *A1 = ICMP->getOperand(1); Value *A1 = ICMP->getOperand(1);
if (!A0->getType()->isIntegerTy()) continue; if (!A0->getType()->isIntegerTy()) continue;
uint64_t TypeSize = DL->getTypeStoreSizeInBits(A0->getType()); uint64_t TypeSize = DL->getTypeStoreSizeInBits(A0->getType());
// __sanitizer_cov_indir_call((type_size << 32) | predicate, A0, A1); // __sanitizer_cov_trace_cmp((type_size << 32) | predicate, A0, A1);
IRB.CreateCall3( IRB.CreateCall3(
SanCovTraceCmpFunction, SanCovTraceCmpFunction,
ConstantInt::get(Int64Ty, (TypeSize << 32) | ICMP->getPredicate()), ConstantInt::get(Int64Ty, (TypeSize << 32) | ICMP->getPredicate()),
@@ -339,7 +339,7 @@ void SanitizerCoverageModule::InjectTraceForCmp(
} }
} }
void SanitizerCoverageModule::SetNoSanitizeMetada(Instruction *I) { void SanitizerCoverageModule::SetNoSanitizeMetadata(Instruction *I) {
I->setMetadata( I->setMetadata(
I->getParent()->getParent()->getParent()->getMDKindID("nosanitize"), I->getParent()->getParent()->getParent()->getMDKindID("nosanitize"),
MDNode::get(*C, None)); MDNode::get(*C, None));
@@ -375,7 +375,7 @@ void SanitizerCoverageModule::InjectCoverageAtBlock(Function &F, BasicBlock &BB,
LoadInst *Load = IRB.CreateLoad(GuardP); LoadInst *Load = IRB.CreateLoad(GuardP);
Load->setAtomic(Monotonic); Load->setAtomic(Monotonic);
Load->setAlignment(4); Load->setAlignment(4);
SetNoSanitizeMetada(Load); SetNoSanitizeMetadata(Load);
Value *Cmp = IRB.CreateICmpSGE(Constant::getNullValue(Load->getType()), Load); Value *Cmp = IRB.CreateICmpSGE(Constant::getNullValue(Load->getType()), Load);
Instruction *Ins = SplitBlockAndInsertIfThen( Instruction *Ins = SplitBlockAndInsertIfThen(
Cmp, IP, false, MDBuilder(*C).createBranchWeights(1, 100000)); Cmp, IP, false, MDBuilder(*C).createBranchWeights(1, 100000));
@@ -395,8 +395,8 @@ void SanitizerCoverageModule::InjectCoverageAtBlock(Function &F, BasicBlock &BB,
LoadInst *LI = IRB.CreateLoad(P); LoadInst *LI = IRB.CreateLoad(P);
Value *Inc = IRB.CreateAdd(LI, ConstantInt::get(IRB.getInt8Ty(), 1)); Value *Inc = IRB.CreateAdd(LI, ConstantInt::get(IRB.getInt8Ty(), 1));
StoreInst *SI = IRB.CreateStore(Inc, P); StoreInst *SI = IRB.CreateStore(Inc, P);
SetNoSanitizeMetada(LI); SetNoSanitizeMetadata(LI);
SetNoSanitizeMetada(SI); SetNoSanitizeMetadata(SI);
} }
if (ClExperimentalTracing) { if (ClExperimentalTracing) {