[sancov] Fix an unused variable warning introduced in r245067
[oota-llvm.git] / lib / Transforms / Instrumentation / SanitizerCoverage.cpp
1 //===-- SanitizerCoverage.cpp - coverage instrumentation for sanitizers ---===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Coverage instrumentation that works with AddressSanitizer
11 // and potentially with other Sanitizers.
12 //
13 // We create a Guard variable with the same linkage
14 // as the function and inject this code into the entry block (SCK_Function)
15 // or all blocks (SCK_BB):
16 // if (Guard < 0) {
17 //    __sanitizer_cov(&Guard);
18 // }
19 // The accesses to Guard are atomic. The rest of the logic is
20 // in __sanitizer_cov (it's fine to call it more than once).
21 //
22 // With SCK_Edge we also split critical edges this effectively
23 // instrumenting all edges.
24 //
25 // This coverage implementation provides very limited data:
26 // it only tells if a given function (block) was ever executed. No counters.
27 // But for many use cases this is what we need and the added slowdown small.
28 //
29 //===----------------------------------------------------------------------===//
30
31 #include "llvm/Transforms/Instrumentation.h"
32 #include "llvm/ADT/ArrayRef.h"
33 #include "llvm/ADT/SmallVector.h"
34 #include "llvm/IR/CallSite.h"
35 #include "llvm/IR/DataLayout.h"
36 #include "llvm/IR/DebugInfo.h"
37 #include "llvm/IR/Function.h"
38 #include "llvm/IR/IRBuilder.h"
39 #include "llvm/IR/InlineAsm.h"
40 #include "llvm/IR/LLVMContext.h"
41 #include "llvm/IR/MDBuilder.h"
42 #include "llvm/IR/Module.h"
43 #include "llvm/IR/Type.h"
44 #include "llvm/Support/CommandLine.h"
45 #include "llvm/Support/Debug.h"
46 #include "llvm/Support/raw_ostream.h"
47 #include "llvm/Transforms/Scalar.h"
48 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
49 #include "llvm/Transforms/Utils/ModuleUtils.h"
50
51 using namespace llvm;
52
53 #define DEBUG_TYPE "sancov"
54
55 static const char *const kSanCovModuleInitName = "__sanitizer_cov_module_init";
56 static const char *const kSanCovName = "__sanitizer_cov";
57 static const char *const kSanCovWithCheckName = "__sanitizer_cov_with_check";
58 static const char *const kSanCovIndirCallName = "__sanitizer_cov_indir_call16";
59 static const char *const kSanCovTraceEnter = "__sanitizer_cov_trace_func_enter";
60 static const char *const kSanCovTraceBB = "__sanitizer_cov_trace_basic_block";
61 static const char *const kSanCovTraceCmp = "__sanitizer_cov_trace_cmp";
62 static const char *const kSanCovTraceSwitch = "__sanitizer_cov_trace_switch";
63 static const char *const kSanCovModuleCtorName = "sancov.module_ctor";
64 static const uint64_t    kSanCtorAndDtorPriority = 2;
65
66 static cl::opt<int> ClCoverageLevel("sanitizer-coverage-level",
67        cl::desc("Sanitizer Coverage. 0: none, 1: entry block, 2: all blocks, "
68                 "3: all blocks and critical edges, "
69                 "4: above plus indirect calls"),
70        cl::Hidden, cl::init(0));
71
72 static cl::opt<unsigned> ClCoverageBlockThreshold(
73     "sanitizer-coverage-block-threshold",
74     cl::desc("Use a callback with a guard check inside it if there are"
75              " more than this number of blocks."),
76     cl::Hidden, cl::init(500));
77
78 static cl::opt<bool>
79     ClExperimentalTracing("sanitizer-coverage-experimental-tracing",
80                           cl::desc("Experimental basic-block tracing: insert "
81                                    "callbacks at every basic block"),
82                           cl::Hidden, cl::init(false));
83
84 static cl::opt<bool>
85     ClExperimentalCMPTracing("sanitizer-coverage-experimental-trace-compares",
86                              cl::desc("Experimental tracing of CMP and similar "
87                                       "instructions"),
88                              cl::Hidden, cl::init(false));
89
90 // Experimental 8-bit counters used as an additional search heuristic during
91 // coverage-guided fuzzing.
92 // The counters are not thread-friendly:
93 //   - contention on these counters may cause significant slowdown;
94 //   - the counter updates are racy and the results may be inaccurate.
95 // They are also inaccurate due to 8-bit integer overflow.
96 static cl::opt<bool> ClUse8bitCounters("sanitizer-coverage-8bit-counters",
97                                        cl::desc("Experimental 8-bit counters"),
98                                        cl::Hidden, cl::init(false));
99
100 namespace {
101
102 SanitizerCoverageOptions getOptions(int LegacyCoverageLevel) {
103   SanitizerCoverageOptions Res;
104   switch (LegacyCoverageLevel) {
105   case 0:
106     Res.CoverageType = SanitizerCoverageOptions::SCK_None;
107     break;
108   case 1:
109     Res.CoverageType = SanitizerCoverageOptions::SCK_Function;
110     break;
111   case 2:
112     Res.CoverageType = SanitizerCoverageOptions::SCK_BB;
113     break;
114   case 3:
115     Res.CoverageType = SanitizerCoverageOptions::SCK_Edge;
116     break;
117   case 4:
118     Res.CoverageType = SanitizerCoverageOptions::SCK_Edge;
119     Res.IndirectCalls = true;
120     break;
121   }
122   return Res;
123 }
124
125 SanitizerCoverageOptions OverrideFromCL(SanitizerCoverageOptions Options) {
126   // Sets CoverageType and IndirectCalls.
127   SanitizerCoverageOptions CLOpts = getOptions(ClCoverageLevel);
128   Options.CoverageType = std::max(Options.CoverageType, CLOpts.CoverageType);
129   Options.IndirectCalls |= CLOpts.IndirectCalls;
130   Options.TraceBB |= ClExperimentalTracing;
131   Options.TraceCmp |= ClExperimentalCMPTracing;
132   Options.Use8bitCounters |= ClUse8bitCounters;
133   return Options;
134 }
135
136 class SanitizerCoverageModule : public ModulePass {
137  public:
138   SanitizerCoverageModule(
139       const SanitizerCoverageOptions &Options = SanitizerCoverageOptions())
140       : ModulePass(ID), Options(OverrideFromCL(Options)) {}
141   bool runOnModule(Module &M) override;
142   bool runOnFunction(Function &F);
143   static char ID;  // Pass identification, replacement for typeid
144   const char *getPassName() const override {
145     return "SanitizerCoverageModule";
146   }
147
148  private:
149   void InjectCoverageForIndirectCalls(Function &F,
150                                       ArrayRef<Instruction *> IndirCalls);
151   void InjectTraceForCmp(Function &F, ArrayRef<Instruction *> CmpTraceTargets);
152   void InjectTraceForSwitch(Function &F,
153                             ArrayRef<Instruction *> SwitchTraceTargets);
154   bool InjectCoverage(Function &F, ArrayRef<BasicBlock *> AllBlocks);
155   void SetNoSanitizeMetadata(Instruction *I);
156   void InjectCoverageAtBlock(Function &F, BasicBlock &BB, bool UseCalls);
157   unsigned NumberOfInstrumentedBlocks() {
158     return SanCovFunction->getNumUses() + SanCovWithCheckFunction->getNumUses();
159   }
160   Function *SanCovFunction;
161   Function *SanCovWithCheckFunction;
162   Function *SanCovIndirCallFunction;
163   Function *SanCovTraceEnter, *SanCovTraceBB;
164   Function *SanCovTraceCmpFunction;
165   Function *SanCovTraceSwitchFunction;
166   InlineAsm *EmptyAsm;
167   Type *IntptrTy, *Int64Ty, *Int64PtrTy;
168   Module *CurModule;
169   LLVMContext *C;
170   const DataLayout *DL;
171
172   GlobalVariable *GuardArray;
173   GlobalVariable *EightBitCounterArray;
174
175   SanitizerCoverageOptions Options;
176 };
177
178 }  // namespace
179
180 bool SanitizerCoverageModule::runOnModule(Module &M) {
181   if (Options.CoverageType == SanitizerCoverageOptions::SCK_None)
182     return false;
183   C = &(M.getContext());
184   DL = &M.getDataLayout();
185   CurModule = &M;
186   IntptrTy = Type::getIntNTy(*C, DL->getPointerSizeInBits());
187   Type *VoidTy = Type::getVoidTy(*C);
188   IRBuilder<> IRB(*C);
189   Type *Int8PtrTy = PointerType::getUnqual(IRB.getInt8Ty());
190   Type *Int32PtrTy = PointerType::getUnqual(IRB.getInt32Ty());
191   Int64PtrTy = PointerType::getUnqual(IRB.getInt64Ty());
192   Int64Ty = IRB.getInt64Ty();
193
194   SanCovFunction = checkSanitizerInterfaceFunction(
195       M.getOrInsertFunction(kSanCovName, VoidTy, Int32PtrTy, nullptr));
196   SanCovWithCheckFunction = checkSanitizerInterfaceFunction(
197       M.getOrInsertFunction(kSanCovWithCheckName, VoidTy, Int32PtrTy, nullptr));
198   SanCovIndirCallFunction =
199       checkSanitizerInterfaceFunction(M.getOrInsertFunction(
200           kSanCovIndirCallName, VoidTy, IntptrTy, IntptrTy, nullptr));
201   SanCovTraceCmpFunction =
202       checkSanitizerInterfaceFunction(M.getOrInsertFunction(
203           kSanCovTraceCmp, VoidTy, Int64Ty, Int64Ty, Int64Ty, nullptr));
204   SanCovTraceSwitchFunction =
205       checkSanitizerInterfaceFunction(M.getOrInsertFunction(
206           kSanCovTraceSwitch, VoidTy, Int64Ty, Int64PtrTy, nullptr));
207
208   // We insert an empty inline asm after cov callbacks to avoid callback merge.
209   EmptyAsm = InlineAsm::get(FunctionType::get(IRB.getVoidTy(), false),
210                             StringRef(""), StringRef(""),
211                             /*hasSideEffects=*/true);
212
213   if (Options.TraceBB) {
214     SanCovTraceEnter = checkSanitizerInterfaceFunction(
215         M.getOrInsertFunction(kSanCovTraceEnter, VoidTy, Int32PtrTy, nullptr));
216     SanCovTraceBB = checkSanitizerInterfaceFunction(
217         M.getOrInsertFunction(kSanCovTraceBB, VoidTy, Int32PtrTy, nullptr));
218   }
219
220   // At this point we create a dummy array of guards because we don't
221   // know how many elements we will need.
222   Type *Int32Ty = IRB.getInt32Ty();
223   Type *Int8Ty = IRB.getInt8Ty();
224
225   GuardArray =
226       new GlobalVariable(M, Int32Ty, false, GlobalValue::ExternalLinkage,
227                          nullptr, "__sancov_gen_cov_tmp");
228   if (Options.Use8bitCounters)
229     EightBitCounterArray =
230         new GlobalVariable(M, Int8Ty, false, GlobalVariable::ExternalLinkage,
231                            nullptr, "__sancov_gen_cov_tmp");
232
233   for (auto &F : M)
234     runOnFunction(F);
235
236   auto N = NumberOfInstrumentedBlocks();
237
238   // Now we know how many elements we need. Create an array of guards
239   // with one extra element at the beginning for the size.
240   Type *Int32ArrayNTy = ArrayType::get(Int32Ty, N + 1);
241   GlobalVariable *RealGuardArray = new GlobalVariable(
242       M, Int32ArrayNTy, false, GlobalValue::PrivateLinkage,
243       Constant::getNullValue(Int32ArrayNTy), "__sancov_gen_cov");
244
245
246   // Replace the dummy array with the real one.
247   GuardArray->replaceAllUsesWith(
248       IRB.CreatePointerCast(RealGuardArray, Int32PtrTy));
249   GuardArray->eraseFromParent();
250
251   GlobalVariable *RealEightBitCounterArray;
252   if (Options.Use8bitCounters) {
253     // Make sure the array is 16-aligned.
254     static const int kCounterAlignment = 16;
255     Type *Int8ArrayNTy =
256         ArrayType::get(Int8Ty, RoundUpToAlignment(N, kCounterAlignment));
257     RealEightBitCounterArray = new GlobalVariable(
258         M, Int8ArrayNTy, false, GlobalValue::PrivateLinkage,
259         Constant::getNullValue(Int8ArrayNTy), "__sancov_gen_cov_counter");
260     RealEightBitCounterArray->setAlignment(kCounterAlignment);
261     EightBitCounterArray->replaceAllUsesWith(
262         IRB.CreatePointerCast(RealEightBitCounterArray, Int8PtrTy));
263     EightBitCounterArray->eraseFromParent();
264   }
265
266   // Create variable for module (compilation unit) name
267   Constant *ModNameStrConst =
268       ConstantDataArray::getString(M.getContext(), M.getName(), true);
269   GlobalVariable *ModuleName =
270       new GlobalVariable(M, ModNameStrConst->getType(), true,
271                          GlobalValue::PrivateLinkage, ModNameStrConst);
272
273   Function *CtorFunc;
274   std::tie(CtorFunc, std::ignore) = createSanitizerCtorAndInitFunctions(
275       M, kSanCovModuleCtorName, kSanCovModuleInitName,
276       {Int32PtrTy, IntptrTy, Int8PtrTy, Int8PtrTy},
277       {IRB.CreatePointerCast(RealGuardArray, Int32PtrTy),
278        ConstantInt::get(IntptrTy, N),
279        Options.Use8bitCounters
280            ? IRB.CreatePointerCast(RealEightBitCounterArray, Int8PtrTy)
281            : Constant::getNullValue(Int8PtrTy),
282        IRB.CreatePointerCast(ModuleName, Int8PtrTy)});
283
284   appendToGlobalCtors(M, CtorFunc, kSanCtorAndDtorPriority);
285
286   return true;
287 }
288
289 bool SanitizerCoverageModule::runOnFunction(Function &F) {
290   if (F.empty()) return false;
291   if (F.getName().find(".module_ctor") != std::string::npos)
292     return false;  // Should not instrument sanitizer init functions.
293   if (Options.CoverageType >= SanitizerCoverageOptions::SCK_Edge)
294     SplitAllCriticalEdges(F);
295   SmallVector<Instruction*, 8> IndirCalls;
296   SmallVector<BasicBlock*, 16> AllBlocks;
297   SmallVector<Instruction*, 8> CmpTraceTargets;
298   SmallVector<Instruction*, 8> SwitchTraceTargets;
299   for (auto &BB : F) {
300     AllBlocks.push_back(&BB);
301     for (auto &Inst : BB) {
302       if (Options.IndirectCalls) {
303         CallSite CS(&Inst);
304         if (CS && !CS.getCalledFunction())
305           IndirCalls.push_back(&Inst);
306       }
307       if (Options.TraceCmp) {
308         if (isa<ICmpInst>(&Inst))
309           CmpTraceTargets.push_back(&Inst);
310         if (isa<SwitchInst>(&Inst))
311           SwitchTraceTargets.push_back(&Inst);
312       }
313     }
314   }
315   InjectCoverage(F, AllBlocks);
316   InjectCoverageForIndirectCalls(F, IndirCalls);
317   InjectTraceForCmp(F, CmpTraceTargets);
318   InjectTraceForSwitch(F, SwitchTraceTargets);
319   return true;
320 }
321
322 bool SanitizerCoverageModule::InjectCoverage(Function &F,
323                                              ArrayRef<BasicBlock *> AllBlocks) {
324   switch (Options.CoverageType) {
325   case SanitizerCoverageOptions::SCK_None:
326     return false;
327   case SanitizerCoverageOptions::SCK_Function:
328     InjectCoverageAtBlock(F, F.getEntryBlock(), false);
329     return true;
330   default: {
331     bool UseCalls = ClCoverageBlockThreshold < AllBlocks.size();
332     for (auto BB : AllBlocks)
333       InjectCoverageAtBlock(F, *BB, UseCalls);
334     return true;
335   }
336   }
337 }
338
339 // On every indirect call we call a run-time function
340 // __sanitizer_cov_indir_call* with two parameters:
341 //   - callee address,
342 //   - global cache array that contains kCacheSize pointers (zero-initialized).
343 //     The cache is used to speed up recording the caller-callee pairs.
344 // The address of the caller is passed implicitly via caller PC.
345 // kCacheSize is encoded in the name of the run-time function.
346 void SanitizerCoverageModule::InjectCoverageForIndirectCalls(
347     Function &F, ArrayRef<Instruction *> IndirCalls) {
348   if (IndirCalls.empty()) return;
349   const int kCacheSize = 16;
350   const int kCacheAlignment = 64;  // Align for better performance.
351   Type *Ty = ArrayType::get(IntptrTy, kCacheSize);
352   for (auto I : IndirCalls) {
353     IRBuilder<> IRB(I);
354     CallSite CS(I);
355     Value *Callee = CS.getCalledValue();
356     if (isa<InlineAsm>(Callee)) continue;
357     GlobalVariable *CalleeCache = new GlobalVariable(
358         *F.getParent(), Ty, false, GlobalValue::PrivateLinkage,
359         Constant::getNullValue(Ty), "__sancov_gen_callee_cache");
360     CalleeCache->setAlignment(kCacheAlignment);
361     IRB.CreateCall(SanCovIndirCallFunction,
362                    {IRB.CreatePointerCast(Callee, IntptrTy),
363                     IRB.CreatePointerCast(CalleeCache, IntptrTy)});
364   }
365 }
366
367 // For every switch statement we insert a call:
368 // __sanitizer_cov_trace_switch(CondValue,
369 //      {NumCases, ValueSizeInBits, Case0Value, Case1Value, Case2Value, ... })
370
371 void SanitizerCoverageModule::InjectTraceForSwitch(
372     Function &F, ArrayRef<Instruction *> SwitchTraceTargets) {
373   for (auto I : SwitchTraceTargets) {
374     if (SwitchInst *SI = dyn_cast<SwitchInst>(I)) {
375       IRBuilder<> IRB(I);
376       SmallVector<Constant *, 16> Initializers;
377       Value *Cond = SI->getCondition();
378       if (Cond->getType()->getScalarSizeInBits() >
379           Int64Ty->getScalarSizeInBits())
380         continue;
381       Initializers.push_back(ConstantInt::get(Int64Ty, SI->getNumCases()));
382       Initializers.push_back(
383           ConstantInt::get(Int64Ty, Cond->getType()->getScalarSizeInBits()));
384       if (Cond->getType()->getScalarSizeInBits() <
385           Int64Ty->getScalarSizeInBits())
386         Cond = IRB.CreateIntCast(Cond, Int64Ty, false);
387       for (auto It: SI->cases()) {
388         Constant *C = It.getCaseValue();
389         if (C->getType()->getScalarSizeInBits() <
390             Int64Ty->getScalarSizeInBits())
391           C = ConstantExpr::getCast(CastInst::ZExt, It.getCaseValue(), Int64Ty);
392         Initializers.push_back(C);
393       }
394       ArrayType *ArrayOfInt64Ty = ArrayType::get(Int64Ty, Initializers.size());
395       GlobalVariable *GV = new GlobalVariable(
396           *CurModule, ArrayOfInt64Ty, false, GlobalVariable::InternalLinkage,
397           ConstantArray::get(ArrayOfInt64Ty, Initializers),
398           "__sancov_gen_cov_switch_values");
399       IRB.CreateCall(SanCovTraceSwitchFunction,
400                      {Cond, IRB.CreatePointerCast(GV, Int64PtrTy)});
401     }
402   }
403 }
404
405
406 void SanitizerCoverageModule::InjectTraceForCmp(
407     Function &F, ArrayRef<Instruction *> CmpTraceTargets) {
408   for (auto I : CmpTraceTargets) {
409     if (ICmpInst *ICMP = dyn_cast<ICmpInst>(I)) {
410       IRBuilder<> IRB(ICMP);
411       Value *A0 = ICMP->getOperand(0);
412       Value *A1 = ICMP->getOperand(1);
413       if (!A0->getType()->isIntegerTy()) continue;
414       uint64_t TypeSize = DL->getTypeStoreSizeInBits(A0->getType());
415       // __sanitizer_cov_trace_cmp((type_size << 32) | predicate, A0, A1);
416       IRB.CreateCall(
417           SanCovTraceCmpFunction,
418           {ConstantInt::get(Int64Ty, (TypeSize << 32) | ICMP->getPredicate()),
419            IRB.CreateIntCast(A0, Int64Ty, true),
420            IRB.CreateIntCast(A1, Int64Ty, true)});
421     }
422   }
423 }
424
425 void SanitizerCoverageModule::SetNoSanitizeMetadata(Instruction *I) {
426   I->setMetadata(
427       I->getParent()->getParent()->getParent()->getMDKindID("nosanitize"),
428       MDNode::get(*C, None));
429 }
430
431 void SanitizerCoverageModule::InjectCoverageAtBlock(Function &F, BasicBlock &BB,
432                                                     bool UseCalls) {
433   // Don't insert coverage for unreachable blocks: we will never call
434   // __sanitizer_cov() for them, so counting them in
435   // NumberOfInstrumentedBlocks() might complicate calculation of code coverage
436   // percentage. Also, unreachable instructions frequently have no debug
437   // locations.
438   if (isa<UnreachableInst>(BB.getTerminator()))
439     return;
440   BasicBlock::iterator IP = BB.getFirstInsertionPt();
441
442   bool IsEntryBB = &BB == &F.getEntryBlock();
443   DebugLoc EntryLoc;
444   if (IsEntryBB) {
445     if (auto SP = getDISubprogram(&F))
446       EntryLoc = DebugLoc::get(SP->getScopeLine(), 0, SP);
447     // Keep static allocas and llvm.localescape calls in the entry block.  Even
448     // if we aren't splitting the block, it's nice for allocas to be before
449     // calls.
450     IP = PrepareToSplitEntryBlock(BB, IP);
451   } else {
452     EntryLoc = IP->getDebugLoc();
453   }
454
455   IRBuilder<> IRB(IP);
456   IRB.SetCurrentDebugLocation(EntryLoc);
457   Value *GuardP = IRB.CreateAdd(
458       IRB.CreatePointerCast(GuardArray, IntptrTy),
459       ConstantInt::get(IntptrTy, (1 + NumberOfInstrumentedBlocks()) * 4));
460   Type *Int32PtrTy = PointerType::getUnqual(IRB.getInt32Ty());
461   GuardP = IRB.CreateIntToPtr(GuardP, Int32PtrTy);
462   if (UseCalls) {
463     IRB.CreateCall(SanCovWithCheckFunction, GuardP);
464   } else {
465     LoadInst *Load = IRB.CreateLoad(GuardP);
466     Load->setAtomic(Monotonic);
467     Load->setAlignment(4);
468     SetNoSanitizeMetadata(Load);
469     Value *Cmp = IRB.CreateICmpSGE(Constant::getNullValue(Load->getType()), Load);
470     Instruction *Ins = SplitBlockAndInsertIfThen(
471         Cmp, IP, false, MDBuilder(*C).createBranchWeights(1, 100000));
472     IRB.SetInsertPoint(Ins);
473     IRB.SetCurrentDebugLocation(EntryLoc);
474     // __sanitizer_cov gets the PC of the instruction using GET_CALLER_PC.
475     IRB.CreateCall(SanCovFunction, GuardP);
476     IRB.CreateCall(EmptyAsm, {}); // Avoids callback merge.
477   }
478
479   if (Options.Use8bitCounters) {
480     IRB.SetInsertPoint(IP);
481     Value *P = IRB.CreateAdd(
482         IRB.CreatePointerCast(EightBitCounterArray, IntptrTy),
483         ConstantInt::get(IntptrTy, NumberOfInstrumentedBlocks() - 1));
484     P = IRB.CreateIntToPtr(P, IRB.getInt8PtrTy());
485     LoadInst *LI = IRB.CreateLoad(P);
486     Value *Inc = IRB.CreateAdd(LI, ConstantInt::get(IRB.getInt8Ty(), 1));
487     StoreInst *SI = IRB.CreateStore(Inc, P);
488     SetNoSanitizeMetadata(LI);
489     SetNoSanitizeMetadata(SI);
490   }
491
492   if (Options.TraceBB) {
493     // Experimental support for tracing.
494     // Insert a callback with the same guard variable as used for coverage.
495     IRB.SetInsertPoint(IP);
496     IRB.CreateCall(IsEntryBB ? SanCovTraceEnter : SanCovTraceBB, GuardP);
497   }
498 }
499
500 char SanitizerCoverageModule::ID = 0;
501 INITIALIZE_PASS(SanitizerCoverageModule, "sancov",
502     "SanitizerCoverage: TODO."
503     "ModulePass", false, false)
504 ModulePass *llvm::createSanitizerCoverageModulePass(
505     const SanitizerCoverageOptions &Options) {
506   return new SanitizerCoverageModule(Options);
507 }