diff -upr AFL-2.57b.orig/llvm_mode/afl-llvm-pass.so.cc AFL-2.57b/llvm_mode/afl-llvm-pass.so.cc
--- AFL-2.57b.orig/llvm_mode/afl-llvm-pass.so.cc	2020-07-04 19:24:18.000000000 +0300
+++ AFL-2.57b/llvm_mode/afl-llvm-pass.so.cc	2022-06-23 04:41:29.536472961 +0300
@@ -42,6 +42,7 @@
 #include "llvm/IR/IRBuilder.h"
 #include "llvm/IR/LegacyPassManager.h"
 #include "llvm/IR/Module.h"
+#include "llvm/Pass.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Transforms/IPO/PassManagerBuilder.h"
 
@@ -131,20 +132,20 @@ bool AFLCoverage::runOnModule(Module &M)
 
       /* Load prev_loc */
 
-      LoadInst *PrevLoc = IRB.CreateLoad(AFLPrevLoc);
+      LoadInst *PrevLoc = IRB.CreateLoad(AFLPrevLoc->getType()->getScalarType()->getPointerElementType(), AFLPrevLoc);
       PrevLoc->setMetadata(M.getMDKindID("nosanitize"), MDNode::get(C, None));
       Value *PrevLocCasted = IRB.CreateZExt(PrevLoc, IRB.getInt32Ty());
 
       /* Load SHM pointer */
 
-      LoadInst *MapPtr = IRB.CreateLoad(AFLMapPtr);
+      LoadInst *MapPtr = IRB.CreateLoad(AFLMapPtr->getType()->getScalarType()->getPointerElementType(), AFLMapPtr);
       MapPtr->setMetadata(M.getMDKindID("nosanitize"), MDNode::get(C, None));
       Value *MapPtrIdx =
-          IRB.CreateGEP(MapPtr, IRB.CreateXor(PrevLocCasted, CurLoc));
+          IRB.CreateGEP(MapPtr->getType()->getScalarType()->getPointerElementType(), MapPtr, IRB.CreateXor(PrevLocCasted, CurLoc));
 
       /* Update bitmap */
 
-      LoadInst *Counter = IRB.CreateLoad(MapPtrIdx);
+      LoadInst *Counter = IRB.CreateLoad(MapPtrIdx->getType()->getScalarType()->getPointerElementType(), MapPtrIdx);
       Counter->setMetadata(M.getMDKindID("nosanitize"), MDNode::get(C, None));
       Value *Incr = IRB.CreateAdd(Counter, ConstantInt::get(Int8Ty, 1));
       IRB.CreateStore(Incr, MapPtrIdx)