Skip to content

Commit aa2cbfe

Browse files
committed
Run instrumentation function twice if verification requested
1 parent 2b8d9ea commit aa2cbfe

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

llvm/lib/Transforms/Instrumentation/TypeSanitizer.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ static cl::opt<bool> ClOutlineInstrumentation(
6464
"ELF size"),
6565
cl::Hidden, cl::init(false));
6666

67+
68+
static cl::opt<bool> ClVerifyOutlinedInstrumentation(
69+
"tysan-verify-outlined-instrumentation",
70+
cl::desc("Check types twice with both inlined instrumentation and "
71+
"function calls. This verifies that they behave the same."),
72+
cl::Hidden, cl::init(false));
73+
6774
STATISTIC(NumInstrumentedAccesses, "Number of instrumented accesses");
6875

6976
namespace {
@@ -958,6 +965,11 @@ PreservedAnalyses TypeSanitizerPass::run(Module &M,
958965
for (Function &F : M) {
959966
const TargetLibraryInfo &TLI = FAM.getResult<TargetLibraryAnalysis>(F);
960967
TySan.sanitizeFunction(F, TLI);
968+
if (ClVerifyOutlinedInstrumentation && ClOutlineInstrumentation) {
969+
ClOutlineInstrumentation = false;
970+
TySan.sanitizeFunction(F, TLI);
971+
ClOutlineInstrumentation = true;
972+
}
961973
}
962974

963975
return PreservedAnalyses::none();

0 commit comments

Comments
 (0)