about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--instrumentation/SanitizerCoverageLTO.so.cc18
-rw-r--r--instrumentation/SanitizerCoveragePCGUARD.so.cc7
-rw-r--r--instrumentation/cmplog-instructions-pass.cc11
3 files changed, 26 insertions, 10 deletions
diff --git a/instrumentation/SanitizerCoverageLTO.so.cc b/instrumentation/SanitizerCoverageLTO.so.cc
index fbbe24a2..ee8c317e 100644
--- a/instrumentation/SanitizerCoverageLTO.so.cc
+++ b/instrumentation/SanitizerCoverageLTO.so.cc
@@ -1296,6 +1296,12 @@ void ModuleSanitizerCoverage::instrumentFunction(
 
       SelectInst *selectInst = nullptr;
 
+      /*
+            std::string errMsg;
+            raw_string_ostream os(errMsg);
+            IN.print(os);
+            fprintf(stderr, "X(%u): %s\n", skip_next, os.str().c_str());
+      */
       if (!skip_next && (selectInst = dyn_cast<SelectInst>(&IN))) {
 
         uint32_t    vector_cnt = 0;
@@ -1311,12 +1317,13 @@ void ModuleSanitizerCoverage::instrumentFunction(
           Value *val1 = ConstantInt::get(Int32Ty, ++afl_global_id);
           Value *val2 = ConstantInt::get(Int32Ty, ++afl_global_id);
           result = IRB.CreateSelect(condition, val1, val2);
+          skip_next = 1;
           inst += 2;
 
-        }
+        } else
 
 #if LLVM_VERSION_MAJOR > 13
-        else if (t->getTypeID() == llvm::Type::FixedVectorTyID) {
+            if (t->getTypeID() == llvm::Type::FixedVectorTyID) {
 
           FixedVectorType *tt = dyn_cast<FixedVectorType>(t);
           if (tt) {
@@ -1346,13 +1353,8 @@ void ModuleSanitizerCoverage::instrumentFunction(
 
               }
 
-              /*
-                          std::string errMsg;
-                          raw_string_ostream os(errMsg);
-                      x->print(os);
-                      fprintf(stderr, "X: %s\n", os.str().c_str());
-              */
               result = IRB.CreateSelect(condition, x, y);
+              skip_next = 1;
 
             }
 
diff --git a/instrumentation/SanitizerCoveragePCGUARD.so.cc b/instrumentation/SanitizerCoveragePCGUARD.so.cc
index 10c9430e..be3f4f49 100644
--- a/instrumentation/SanitizerCoveragePCGUARD.so.cc
+++ b/instrumentation/SanitizerCoveragePCGUARD.so.cc
@@ -865,7 +865,10 @@ bool ModuleSanitizerCoverage::InjectCoverage(Function &             F,
           cnt_sel++;
           cnt_sel_inc += 2;
 
-        } else if (t->getTypeID() == llvm::Type::FixedVectorTyID) {
+        }
+
+#if LLVM__MAJOR > 11
+        else if (t->getTypeID() == llvm::Type::FixedVectorTyID) {
 
           FixedVectorType *tt = dyn_cast<FixedVectorType>(t);
           if (tt) {
@@ -877,6 +880,8 @@ bool ModuleSanitizerCoverage::InjectCoverage(Function &             F,
 
         }
 
+#endif
+
       }
 
     }
diff --git a/instrumentation/cmplog-instructions-pass.cc b/instrumentation/cmplog-instructions-pass.cc
index cb149e9a..01a8a637 100644
--- a/instrumentation/cmplog-instructions-pass.cc
+++ b/instrumentation/cmplog-instructions-pass.cc
@@ -338,8 +338,10 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
 
           }
 
+#if LLVM_MAJOR > 11
           vector_cnt = tt->getElementCount().getFixedValue();
           ty0 = tt->getElementType();
+#endif
 
         }
 
@@ -357,9 +359,11 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
           max_size = 80;
         else if (ty0->isFP128Ty() || ty0->isPPC_FP128Ty())
           max_size = 128;
+#if LLVM_MAJOR > 11
         else if (ty0->getTypeID() != llvm::Type::PointerTyID && !be_quiet)
           fprintf(stderr, "Warning: unsupported cmp type for cmplog: %u!\n",
                   ty0->getTypeID());
+#endif
 
         attr += 8;
 
@@ -367,6 +371,7 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
 
         if (ty0->isVectorTy()) {
 
+#if LLVM_MAJOR > 11
           VectorType *tt = dyn_cast<VectorType>(ty0);
           if (!tt) {
 
@@ -377,6 +382,7 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
 
           vector_cnt = tt->getElementCount().getFixedValue();
           ty1 = ty0 = tt->getElementType();
+#endif
 
         }
 
@@ -391,13 +397,16 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
 
         } else {
 
+#if LLVM_MAJOR > 11
           if (ty0->getTypeID() != llvm::Type::PointerTyID && !be_quiet) {
 
-            fprintf(stderr, "Warning: unsupported cmp type for cmplog: %u!\n",
+            fprintf(stderr, "Warning: unsupported cmp type for cmplog: %u\n",
                     ty0->getTypeID());
 
           }
 
+#endif
+
         }
 
       }