From ecc7fae9cbac9aa970aac072276e5bca1c583c02 Mon Sep 17 00:00:00 2001 From: Martin Nowack Date: Sun, 29 Jul 2018 16:51:32 +0100 Subject: ShiftChecker: Instrument shift instructions only once As the shift checker could be executed multiple times, we need to avoid that shift instructions are instrumented multiple times as well. Mark the instrumented instruction using metadata and avoid it in successive runs. --- lib/Module/Checks.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib') diff --git a/lib/Module/Checks.cpp b/lib/Module/Checks.cpp index 53ba4266..9286c491 100644 --- a/lib/Module/Checks.cpp +++ b/lib/Module/Checks.cpp @@ -116,6 +116,9 @@ bool OvershiftCheckPass::runOnModule(Module &M) { continue; } + if (KleeIRMetaData::hasAnnotation(I, "klee.check.shift", "True")) + continue; + shiftInstructions.push_back(binOp); } } @@ -126,6 +129,7 @@ bool OvershiftCheckPass::runOnModule(Module &M) { // Retrieve the checker function auto &ctx = M.getContext(); + KleeIRMetaData md(ctx); auto overshiftCheckFunction = cast(M.getOrInsertFunction( "klee_overshift_check", Type::getVoidTy(ctx), Type::getInt64Ty(ctx), Type::getInt64Ty(ctx), NULL)); @@ -147,6 +151,7 @@ bool OvershiftCheckPass::runOnModule(Module &M) { args.push_back(shiftValue); Builder.CreateCall(overshiftCheckFunction, args); + md.addAnnotation(*shiftInst, "klee.check.shift", "True"); } return true; -- cgit 1.4.1