klee/0020-llvm50-CallSite.paramHasAttr-is-indexed-from-0.patch

47 lines
1.7 KiB
Diff

From: Jiri Slaby <jirislaby@gmail.com>
Date: Fri, 20 Jul 2018 10:06:29 +0200
Subject: llvm50: CallSite.paramHasAttr is indexed from 0
Patch-mainline: no
Since LLVM 5 commit 1f8f0490690b, CallSite.paramHasAttr is indexed from
0, so make sure we use correct indexing in klee. And use
CallSite.hasRetAttr for return attributes.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
lib/Core/Executor.cpp | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
index 46fd2be42351..f05561e7fe82 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -1543,7 +1543,11 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
CallSite(cast<CallInst>(caller)));
// XXX need to check other param attrs ?
- bool isSExt = cs.paramHasAttr(0, llvm::Attribute::SExt);
+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0)
+ bool isSExt = cs.hasRetAttr(llvm::Attribute::SExt);
+#else
+ bool isSExt = cs.paramHasAttr(0, llvm::Attribute::SExt);
+#endif
if (isSExt) {
result = SExtExpr::create(result, to);
} else {
@@ -1837,7 +1841,11 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
if (from != to) {
// XXX need to check other param attrs ?
+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0)
+ bool isSExt = cs.paramHasAttr(i, llvm::Attribute::SExt);
+#else
bool isSExt = cs.paramHasAttr(i+1, llvm::Attribute::SExt);
+#endif
if (isSExt) {
arguments[i] = SExtExpr::create(arguments[i], to);
} else {
--
2.18.0