klee/0020-llvm50-AllocaInst-takes-address-space.patch

40 lines
1.3 KiB
Diff

From: Jiri Slaby <jirislaby@gmail.com>
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 <jirislaby@gmail.com>
---
tools/klee/main.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
index ff87d210b863..c85fee861f03 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -664,10 +664,18 @@ static int 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<const Type*> params;
--
2.17.0