about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2021-11-03 12:49:54 +0100
committervanhauser-thc <vh@thc.org>2021-11-03 12:49:54 +0100
commitccded9fc5cfead1b88104484c4acde12e81e0afe (patch)
tree2ed0dc70a25f410bf165a4cd13767ff4251f91ac
parentcaf68e5bf25a8a73bcc21b870499b640e7702d85 (diff)
downloadafl++-ccded9fc5cfead1b88104484c4acde12e81e0afe.tar.gz
vectorized coverage only possible for llvm 14 :(
-rw-r--r--instrumentation/SanitizerCoverageLTO.so.cc10
-rw-r--r--instrumentation/SanitizerCoveragePCGUARD.so.cc17
-rw-r--r--instrumentation/cmplog-instructions-pass.cc1
3 files changed, 23 insertions, 5 deletions
diff --git a/instrumentation/SanitizerCoverageLTO.so.cc b/instrumentation/SanitizerCoverageLTO.so.cc
index b3a6ba45..fbbe24a2 100644
--- a/instrumentation/SanitizerCoverageLTO.so.cc
+++ b/instrumentation/SanitizerCoverageLTO.so.cc
@@ -1313,7 +1313,10 @@ void ModuleSanitizerCoverage::instrumentFunction(
           result = IRB.CreateSelect(condition, val1, val2);
           inst += 2;
 
-        } else if (t->getTypeID() == llvm::Type::FixedVectorTyID) {
+        }
+
+#if LLVM_VERSION_MAJOR > 13
+        else if (t->getTypeID() == llvm::Type::FixedVectorTyID) {
 
           FixedVectorType *tt = dyn_cast<FixedVectorType>(t);
           if (tt) {
@@ -1355,7 +1358,10 @@ void ModuleSanitizerCoverage::instrumentFunction(
 
           }
 
-        } else {
+        } else
+
+#endif
+        {
 
           unhandled++;
           continue;
diff --git a/instrumentation/SanitizerCoveragePCGUARD.so.cc b/instrumentation/SanitizerCoveragePCGUARD.so.cc
index 70af2ee2..10c9430e 100644
--- a/instrumentation/SanitizerCoveragePCGUARD.so.cc
+++ b/instrumentation/SanitizerCoveragePCGUARD.so.cc
@@ -895,6 +895,12 @@ bool ModuleSanitizerCoverage::InjectCoverage(Function &             F,
 
       CallInst *callInst = nullptr;
 
+      /*
+                                std::string errMsg;
+                                raw_string_ostream os(errMsg);
+                            IN.print(os);
+                            fprintf(stderr, "X: %s\n", os.str().c_str());
+      */
       if ((callInst = dyn_cast<CallInst>(&IN))) {
 
         Function *Callee = callInst->getCalledFunction();
@@ -948,7 +954,10 @@ bool ModuleSanitizerCoverage::InjectCoverage(Function &             F,
 
           result = IRB.CreateSelect(condition, GuardPtr1, GuardPtr2);
 
-        } else if (t->getTypeID() == llvm::Type::FixedVectorTyID) {
+        } else
+
+#if LLVM_VERSION_MAJOR > 13
+            if (t->getTypeID() == llvm::Type::FixedVectorTyID) {
 
           FixedVectorType *tt = dyn_cast<FixedVectorType>(t);
           if (tt) {
@@ -1015,9 +1024,13 @@ bool ModuleSanitizerCoverage::InjectCoverage(Function &             F,
 
           }
 
-        } else {
+        } else
+
+#endif
+        {
 
           unhandled++;
+          continue;
 
         }
 
diff --git a/instrumentation/cmplog-instructions-pass.cc b/instrumentation/cmplog-instructions-pass.cc
index 86e206f1..cb149e9a 100644
--- a/instrumentation/cmplog-instructions-pass.cc
+++ b/instrumentation/cmplog-instructions-pass.cc
@@ -377,7 +377,6 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
 
           vector_cnt = tt->getElementCount().getFixedValue();
           ty1 = ty0 = tt->getElementType();
-          fprintf(stderr, "vec %u\n", vector_cnt);
 
         }