move afl_loop check
MODIFY
llvm_mode/afl-llvm-lto-instrumentation.so.cc
llvm_mode/afl-llvm-lto-instrumentation.so.cc
@@ -602,35 +602,20 @@ bool AFLLTOPass::runOnModule(Module &M) {
for (auto &BB : F) {
- uint32_t succ = 0;
+ if (F.size() == 1) {
+
+ InsBlocks.push_back(&BB);
+ continue;
- if (F.size() == 1) InsBlocks.push_back(&BB);
+ }
+ uint32_t succ = 0;
for (succ_iterator SI = succ_begin(&BB), SE = succ_end(&BB); SI != SE;
++SI)
if ((*SI)->size() > 0) succ++;
-
if (succ < 2) // no need to instrument
continue;
- InsBlocks.push_back(&BB);
-
- }
-
- if (InsBlocks.size() > 0) {
-
- uint32_t i = InsBlocks.size();
-
- do {
-
- --i;
- BasicBlock * newBB = NULL;
- BasicBlock * origBB = &(*InsBlocks[i]);
- std::vector<BasicBlock *> Successors;
- Instruction * TI = origBB->getTerminator();
- uint32_t fs = origBB->getParent()->size();
- uint32_t countto;
-
if (BlockList.size()) {
int skip = 0;
@@ -639,8 +624,7 @@ bool AFLLTOPass::runOnModule(Module &M) {
if (origBB == BlockList[k]) {
if (debug)
- fprintf(
- stderr,
+ fprintf(stderr,
"DEBUG: Function %s skipping BB with/after __afl_loop\n",
F.getName().str().c_str());
skip = 1;
@@ -653,6 +637,24 @@ bool AFLLTOPass::runOnModule(Module &M) {
}
+ InsBlocks.push_back(&BB);
+
+ }
+
+ if (InsBlocks.size() > 0) {
+
+ uint32_t i = InsBlocks.size();
+
+ do {
+
+ --i;
+ BasicBlock * newBB = NULL;
+ BasicBlock * origBB = &(*InsBlocks[i]);
+ std::vector<BasicBlock *> Successors;
+ Instruction * TI = origBB->getTerminator();
+ uint32_t fs = origBB->getParent()->size();
+ uint32_t countto;
+
for (succ_iterator SI = succ_begin(origBB), SE = succ_end(origBB);
SI != SE; ++SI) {

move afl_loop check