about summary refs log tree commit diff
diff options
context:
space:
mode:
m---------custom_mutators/grammar_mutator/grammar_mutator0
-rw-r--r--instrumentation/cmplog-instructions-pass.cc81
-rw-r--r--instrumentation/cmplog-routines-pass.cc2
m---------unicorn_mode/unicornafl0
4 files changed, 3 insertions, 80 deletions
diff --git a/custom_mutators/grammar_mutator/grammar_mutator b/custom_mutators/grammar_mutator/grammar_mutator
-Subproject ff4e5a265daf5d88c4a636fb6a2c22b1d733db0
+Subproject cbe5e32752773945e0142fac9f1b7a0ccb5dcdf
diff --git a/instrumentation/cmplog-instructions-pass.cc b/instrumentation/cmplog-instructions-pass.cc
index 85d48835..4d37bcb2 100644
--- a/instrumentation/cmplog-instructions-pass.cc
+++ b/instrumentation/cmplog-instructions-pass.cc
@@ -32,15 +32,9 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
 #if LLVM_MAJOR >= 11
-  #include "llvm/Pass.h"
-  #include "llvm/InitializePasses.h"
   #include "llvm/Passes/PassPlugin.h"
   #include "llvm/Passes/PassBuilder.h"
   #include "llvm/IR/PassManager.h"
-  #include "llvm/Analysis/EHPersonalities.h"
-  #include "llvm/Analysis/PostDominators.h"
-  #include "llvm/Analysis/LoopInfo.h"
-  #include "llvm/Analysis/LoopPass.h"
 #else
   #include "llvm/IR/LegacyPassManager.h"
   #include "llvm/Transforms/IPO/PassManagerBuilder.h"
@@ -70,10 +64,7 @@ using namespace llvm;
 
 namespace {
 
-using LoopInfoCallback = function_ref<const LoopInfo *(Function &F)>;
-
 #if LLVM_MAJOR >= 11                                /* use new pass manager */
-
 class CmpLogInstructions : public PassInfoMixin<CmpLogInstructions> {
 
  public:
@@ -97,7 +88,6 @@ class CmpLogInstructions : public ModulePass {
 #endif
 
 #if LLVM_MAJOR >= 11                                /* use new pass manager */
-
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
 #else
   bool      runOnModule(Module &M) override;
@@ -116,8 +106,7 @@ class CmpLogInstructions : public ModulePass {
 #endif
 
  private:
-  bool         hookInstrs(Module &M, LoopInfoCallback LCallback);
-  unsigned int instrumented = 0;
+  bool hookInstrs(Module &M);
 
 };
 
@@ -164,7 +153,7 @@ Iterator Unique(Iterator first, Iterator last) {
 
 }
 
-bool CmpLogInstructions::hookInstrs(Module &M, LoopInfoCallback LCallback) {
+bool CmpLogInstructions::hookInstrs(Module &M) {
 
   std::vector<Instruction *> icomps;
   LLVMContext &              C = M.getContext();
@@ -301,64 +290,14 @@ bool CmpLogInstructions::hookInstrs(Module &M, LoopInfoCallback LCallback) {
 
     if (!isInInstrumentList(&F, MNAME)) continue;
 
-    std::vector<BasicBlock *> lcomps;
-    const LoopInfo *          LI = LCallback(F);
-#if 0
-    for (LoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I) {
-
-      Loop *      L = *I;
-      BasicBlock *In, *Out;
-      bool        ok = false ; L->getIncomingAndBackEdge(In, Out);
-      if (ok) {
-
-        BasicBlock *decisionBB = In->getSingleSuccessor();
-
-        if (decisionBB) {
-
-          /*
-                    std::string errMsg1;
-                    raw_string_ostream os1(errMsg1);
-                    In->print(os1);
-                    fprintf(stderr, "In: %s\n", os1.str().c_str());
-                    std::string errMsg2;
-                    raw_string_ostream os2(errMsg2);
-                    Out->print(os2);
-                    fprintf(stderr, "Out: %s\n", os2.str().c_str());
-                    std::string errMsg3;
-                    raw_string_ostream os3(errMsg3);
-                    decisionBB->print(os3);
-                    fprintf(stderr, "Dec: %s\n", os3.str().c_str());
-          */
-          lcomps.push_back(decisionBB);
-
-        }
-
-      }
-
-    }
-
-#endif
-
-    //    fprintf(stderr, "Loops in %s: %zu\n", F.getName().str().c_str(),
-    //    lcomps.size());
-
     for (auto &BB : F) {
 
-      if (std::find(lcomps.begin(), lcomps.end(), &BB) != lcomps.end()) {
-
-        fprintf(stderr, "skipping: %p %s\n", &BB, BB.getName().str().c_str());
-
-        continue;
-
-      }
-
       for (auto &IN : BB) {
 
         CmpInst *selectcmpInst = nullptr;
         if ((selectcmpInst = dyn_cast<CmpInst>(&IN))) {
 
           icomps.push_back(selectcmpInst);
-          fprintf(stderr, "Found icomp %p in %p\n", selectcmpInst, &BB);
 
         }
 
@@ -706,8 +645,6 @@ bool CmpLogInstructions::hookInstrs(Module &M, LoopInfoCallback LCallback) {
 
           }
 
-          ++instrumented;
-
         }
 
         /* else fprintf(stderr, "skipped\n"); */
@@ -721,8 +658,6 @@ bool CmpLogInstructions::hookInstrs(Module &M, LoopInfoCallback LCallback) {
 
   }
 
-  fprintf(stderr, "instrumented: %u (%zu)\n", instrumented, icomps.size());
-
   if (icomps.size())
     return true;
   else
@@ -743,19 +678,9 @@ bool CmpLogInstructions::runOnModule(Module &M) {
     printf("Running cmplog-instructions-pass by andreafioraldi@gmail.com\n");
   else
     be_quiet = 1;
-
-  auto &FAM = MAM.getResult<FunctionAnalysisManagerModuleProxy>(M).getManager();
-  auto  LoopCallback = [&FAM](Function &F) -> const LoopInfo * {
-
-    return &FAM.getResult<LoopAnalysis>(F);
-
-  };
-
-  hookInstrs(M, LoopCallback);
+  hookInstrs(M);
   verifyModule(M);
 
-  fprintf(stderr, "done cmplog-instructions-pass\n");
-
 #if LLVM_MAJOR >= 11                                /* use new pass manager */
   return PreservedAnalyses::all();
 #else
diff --git a/instrumentation/cmplog-routines-pass.cc b/instrumentation/cmplog-routines-pass.cc
index 708a94bc..8205cfb0 100644
--- a/instrumentation/cmplog-routines-pass.cc
+++ b/instrumentation/cmplog-routines-pass.cc
@@ -761,8 +761,6 @@ bool CmpLogRoutines::runOnModule(Module &M) {
 #endif
   verifyModule(M);
 
-  fprintf(stderr, "done cmplog-routines-pass\n");
-
 #if LLVM_VERSION_MAJOR >= 11                        /* use new pass manager */
   return PA;
 #else
diff --git a/unicorn_mode/unicornafl b/unicorn_mode/unicornafl
-Subproject a44fa94488d01aba60401ccf81f8bebcce685bf
+Subproject d4915053d477dd827b3fe4b494173d3fbf9f456