Skip to content

Commit e13fb97

Browse files
committed
Run instrumentation function twice if verification requested
1 parent 209aebb commit e13fb97

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
@@ -68,6 +68,13 @@ static cl::opt<bool> ClOutlineInstrumentation(
6868
"ELF size"),
6969
cl::Hidden, cl::init(false));
7070

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

7380
namespace {
@@ -954,6 +961,11 @@ PreservedAnalyses TypeSanitizerPass::run(Module &M,
954961
for (Function &F : M) {
955962
const TargetLibraryInfo &TLI = FAM.getResult<TargetLibraryAnalysis>(F);
956963
TySan.sanitizeFunction(F, TLI);
964+
if (ClVerifyOutlinedInstrumentation && ClOutlineInstrumentation) {
965+
ClOutlineInstrumentation = false;
966+
TySan.sanitizeFunction(F, TLI);
967+
ClOutlineInstrumentation = true;
968+
}
957969
}
958970

959971
return PreservedAnalyses::none();

0 commit comments

Comments
 (0)