From 9388395c21e512796b39baca81324ffb7b70de60 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Thu, 15 Jun 2017 15:20:49 +0200 Subject: llvm37: handle GetElementPtrInst::Create's new parameter LLVM 3.7 added a PointeeType parameter to GetElementPtrInst::Create. Let's handle that by a macro called KLEE_LLVM_GEP_TYPE, defined in Version.h. Signed-off-by: Jiri Slaby --- lib/Core/ExternalDispatcher.cpp | 1 + lib/Module/IntrinsicCleaner.cpp | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/Core/ExternalDispatcher.cpp b/lib/Core/ExternalDispatcher.cpp index 70c14050..72b866cf 100644 --- a/lib/Core/ExternalDispatcher.cpp +++ b/lib/Core/ExternalDispatcher.cpp @@ -326,6 +326,7 @@ Function *ExternalDispatcherImpl::createDispatcher(Function *target, Type *argTy = (i < FTy->getNumParams() ? FTy->getParamType(i) : (*ai)->getType()); Instruction *argI64p = GetElementPtrInst::Create( + KLEE_LLVM_GEP_TYPE(nullptr) argI64s, ConstantInt::get(Type::getInt32Ty(ctx), idx), "", dBB); Instruction *argp = diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp index 2ac9db62..3729ff82 100644 --- a/lib/Module/IntrinsicCleaner.cpp +++ b/lib/Module/IntrinsicCleaner.cpp @@ -86,12 +86,16 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) { Value *val = new LoadInst(pSrc, std::string(), ii); new StoreInst(val, pDst, ii); Value *off = ConstantInt::get(Type::getInt64Ty(ctx), 1); - pDst = GetElementPtrInst::Create(pDst, off, std::string(), ii); - pSrc = GetElementPtrInst::Create(pSrc, off, std::string(), ii); + pDst = GetElementPtrInst::Create(KLEE_LLVM_GEP_TYPE(nullptr) + pDst, off, std::string(), ii); + pSrc = GetElementPtrInst::Create(KLEE_LLVM_GEP_TYPE(nullptr) + pSrc, off, std::string(), ii); val = new LoadInst(pSrc, std::string(), ii); new StoreInst(val, pDst, ii); - pDst = GetElementPtrInst::Create(pDst, off, std::string(), ii); - pSrc = GetElementPtrInst::Create(pSrc, off, std::string(), ii); + pDst = GetElementPtrInst::Create(KLEE_LLVM_GEP_TYPE(nullptr) + pDst, off, std::string(), ii); + pSrc = GetElementPtrInst::Create(KLEE_LLVM_GEP_TYPE(nullptr) + pSrc, off, std::string(), ii); val = new LoadInst(pSrc, std::string(), ii); new StoreInst(val, pDst, ii); } -- cgit 1.4.1