about summary refs log tree commit diff homepage
path: root/lib
diff options
context:
space:
mode:
authorLukas Zaoral <lzaoral@redhat.com>2021-08-24 13:59:31 +0200
committerMartinNowack <2443641+MartinNowack@users.noreply.github.com>2021-12-20 14:36:51 +0000
commitebba5c50806d2c67a357ce8091ad861dfa0f434f (patch)
treed77b4b04cc60411dce0e98732d8ea77b4d977a4d /lib
parent3e28c11203af6c96d612e45fb45445e12d41ad7f (diff)
downloadklee-ebba5c50806d2c67a357ce8091ad861dfa0f434f.tar.gz
llvm13: CreateLoad API with implicit types has been deprecated
See: https://github.com/llvm/llvm-project/commit/6312c53870897435b38881795460ad9f34bf9819
Diffstat (limited to 'lib')
-rw-r--r--lib/Core/ExternalDispatcher.cpp6
-rw-r--r--lib/Module/IntrinsicCleaner.cpp13
2 files changed, 13 insertions, 6 deletions
diff --git a/lib/Core/ExternalDispatcher.cpp b/lib/Core/ExternalDispatcher.cpp
index baa5327a..b1bfff47 100644
--- a/lib/Core/ExternalDispatcher.cpp
+++ b/lib/Core/ExternalDispatcher.cpp
@@ -287,7 +287,8 @@ Function *ExternalDispatcherImpl::createDispatcher(Function *target,
       ConstantInt::get(Type::getInt64Ty(ctx), (uintptr_t)(void *)&gTheArgsP),
       PointerType::getUnqual(PointerType::getUnqual(Type::getInt64Ty(ctx))),
       "argsp");
-  auto argI64s = Builder.CreateLoad(argI64sp, "args");
+  auto argI64s = Builder.CreateLoad(
+      argI64sp->getType()->getPointerElementType(), argI64sp, "args");
 
   // Get the target function type.
   FunctionType *FTy = cast<FunctionType>(
@@ -306,7 +307,8 @@ Function *ExternalDispatcherImpl::createDispatcher(Function *target,
                           ConstantInt::get(Type::getInt32Ty(ctx), idx));
 
     auto argp = Builder.CreateBitCast(argI64p, PointerType::getUnqual(argTy));
-    args[i] = Builder.CreateLoad(argp);
+    args[i] =
+        Builder.CreateLoad(argp->getType()->getPointerElementType(), argp);
 
     unsigned argSize = argTy->getPrimitiveSizeInBits();
     idx += ((!!argSize ? argSize : 64) + 63) / 64;
diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp
index b3b356d2..5e720e45 100644
--- a/lib/Module/IntrinsicCleaner.cpp
+++ b/lib/Module/IntrinsicCleaner.cpp
@@ -96,24 +96,29 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) {
               Builder.CreatePointerCast(dst, i8pp, "vacopy.cast.dst");
           auto castedSrc =
               Builder.CreatePointerCast(src, i8pp, "vacopy.cast.src");
-          auto load = Builder.CreateLoad(castedSrc, "vacopy.read");
+          auto load =
+              Builder.CreateLoad(castedSrc->getType()->getPointerElementType(),
+                                 castedSrc, "vacopy.read");
           Builder.CreateStore(load, castedDst, false /* isVolatile */);
         } else {
           assert(WordSize == 8 && "Invalid word size!");
           Type *i64p = PointerType::getUnqual(Type::getInt64Ty(ctx));
           auto pDst = Builder.CreatePointerCast(dst, i64p, "vacopy.cast.dst");
           auto pSrc = Builder.CreatePointerCast(src, i64p, "vacopy.cast.src");
-          auto val = Builder.CreateLoad(pSrc, std::string());
+
+          auto pType = pSrc->getType()->getPointerElementType();
+
+          auto val = Builder.CreateLoad(pType, pSrc);
           Builder.CreateStore(val, pDst, ii);
 
           auto off = ConstantInt::get(Type::getInt64Ty(ctx), 1);
           pDst = Builder.CreateGEP(nullptr, pDst, off, std::string());
           pSrc = Builder.CreateGEP(nullptr, pSrc, off, std::string());
-          val = Builder.CreateLoad(pSrc, std::string());
+          val = Builder.CreateLoad(pType, pSrc);
           Builder.CreateStore(val, pDst);
           pDst = Builder.CreateGEP(nullptr, pDst, off, std::string());
           pSrc = Builder.CreateGEP(nullptr, pSrc, off, std::string());
-          val = Builder.CreateLoad(pSrc, std::string());
+          val = Builder.CreateLoad(pType, pSrc);
           Builder.CreateStore(val, pDst);
         }
         ii->eraseFromParent();