about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--instrumentation/afl-llvm-pass.so.cc7
1 files changed, 2 insertions, 5 deletions
diff --git a/instrumentation/afl-llvm-pass.so.cc b/instrumentation/afl-llvm-pass.so.cc
index 6c898c48..27b53e68 100644
--- a/instrumentation/afl-llvm-pass.so.cc
+++ b/instrumentation/afl-llvm-pass.so.cc
@@ -409,12 +409,9 @@ bool AFLCoverage::runOnModule(Module &M) {
 
     if (F.size() < function_minimum_size) continue;
 
-    unsigned extra_increment_BB = 0;
     for (auto &BB : F) {
 
-      if (extra_increment_BB) {
-          // increment BB
-          --extra_increment_BB;
+      if (BB.getName() == "injected") {
           continue;
       }
       BasicBlock::iterator IP = BB.getFirstInsertionPt();
@@ -662,8 +659,8 @@ bool AFLCoverage::runOnModule(Module &M) {
           // the calculation may need to repeat, if atomic compare_exchange is not successful
           BasicBlock::iterator it(*Counter); it++;
           BasicBlock * end_bb = BB.splitBasicBlock(it);
+          end_bb->setName("injected");
 
-          extra_increment_BB = 2;
           // insert the block before the second half of the split
           BasicBlock * do_while_bb = BasicBlock::Create(C, "injected", end_bb->getParent(), end_bb);