From: Jiri Slaby Date: Mon, 15 Jan 2018 11:10:39 +0100 Subject: llvm50: AllocaInst takes address space Patch-mainline: no Add address space second parameter to new AllocaInst which is required since llvm 5's commit e0b3c335a27ae50c4f339ffb81c18662bc983e52. Signed-off-by: Jiri Slaby --- tools/klee/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp index c0805f457717..d45a92160e59 100644 --- a/tools/klee/main.cpp +++ b/tools/klee/main.cpp @@ -661,10 +661,18 @@ static void initEnv(Module *mainModule) { Value *oldArgv = &*(++mainFn->arg_begin()); #endif +#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0) + const DataLayout &DL = mainFn->getParent()->getDataLayout(); + AllocaInst* argcPtr = + new AllocaInst(oldArgc->getType(), DL.getAllocaAddrSpace(), "argcPtr", firstInst); + AllocaInst* argvPtr = + new AllocaInst(oldArgv->getType(), DL.getAllocaAddrSpace(), "argvPtr", firstInst); +#else AllocaInst* argcPtr = new AllocaInst(oldArgc->getType(), "argcPtr", firstInst); AllocaInst* argvPtr = new AllocaInst(oldArgv->getType(), "argvPtr", firstInst); +#endif /* Insert void klee_init_env(int* argc, char*** argv) */ std::vector params; -- 2.18.0