about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2021-12-16 01:44:50 +0100
committervanhauser-thc <vh@thc.org>2021-12-16 01:44:50 +0100
commitee10461f48c441ee89c8003828969381f5c21205 (patch)
tree5702c01081ae8775eee460aef3e4d67e7f2dff8c
parent9f911bf0bdad0c2283ad880d6ea83f586dd5b510 (diff)
downloadafl++-ee10461f48c441ee89c8003828969381f5c21205.tar.gz
fix llvm 14 changes for ctx and ngram
-rw-r--r--instrumentation/afl-llvm-pass.so.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/instrumentation/afl-llvm-pass.so.cc b/instrumentation/afl-llvm-pass.so.cc
index be0bcbc8..18c0294e 100644
--- a/instrumentation/afl-llvm-pass.so.cc
+++ b/instrumentation/afl-llvm-pass.so.cc
@@ -456,7 +456,7 @@ bool AFLCoverage::runOnModule(Module &M) {
 
           PrevCaller = IRB.CreateLoad(
   #if LLVM_VERSION_MAJOR >= 14
-              IRB.getInt32Ty(),
+              PrevCallerTy,
   #endif
               AFLPrevCaller);
           PrevCaller->setMetadata(M.getMDKindID("nosanitize"),
@@ -628,11 +628,21 @@ bool AFLCoverage::runOnModule(Module &M) {
 
       /* Load prev_loc */
 
-      LoadInst *PrevLoc = IRB.CreateLoad(
+      LoadInst *PrevLoc;
+
+      if (ngram_size) {
+        PrevLoc = IRB.CreateLoad(
+#if LLVM_VERSION_MAJOR >= 14
+          PrevLocTy,
+#endif
+          AFLPrevLoc);
+      } else {
+        PrevLoc = IRB.CreateLoad(
 #if LLVM_VERSION_MAJOR >= 14
           IRB.getInt32Ty(),
 #endif
           AFLPrevLoc);
+      }
       PrevLoc->setMetadata(M.getMDKindID("nosanitize"), MDNode::get(C, None));
       Value *PrevLocTrans;