OBS-URL: https://build.opensuse.org/package/show/devel:tools:statica/klee?expand=0&rev=46
53 lines
2.1 KiB
Diff
53 lines
2.1 KiB
Diff
From: Jiri Slaby <jirislaby@gmail.com>
|
|
Date: Wed, 23 May 2018 15:01:34 +0200
|
|
Subject: llvm50: Intrinsic::objectsize has three arguments
|
|
Patch-mainline: no
|
|
|
|
Modify the IntrinsicCleaner accordingly.
|
|
|
|
We do not do anything with the third argument as we do not handle the
|
|
first argument in any way.
|
|
|
|
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
|
|
---
|
|
lib/Module/IntrinsicCleaner.cpp | 16 ++++++++++++++++
|
|
1 file changed, 16 insertions(+)
|
|
|
|
diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp
|
|
index d4f93bdc591e..e8c63cd334d0 100644
|
|
--- a/lib/Module/IntrinsicCleaner.cpp
|
|
+++ b/lib/Module/IntrinsicCleaner.cpp
|
|
@@ -230,13 +230,29 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) {
|
|
case Intrinsic::objectsize: {
|
|
// We don't know the size of an object in general so we replace
|
|
// with 0 or -1 depending on the second argument to the intrinsic.
|
|
+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0)
|
|
+ assert(ii->getNumArgOperands() == 3 && "wrong number of arguments");
|
|
+#else
|
|
assert(ii->getNumArgOperands() == 2 && "wrong number of arguments");
|
|
+#endif
|
|
+
|
|
Value *minArg = ii->getArgOperand(1);
|
|
assert(minArg && "Failed to get second argument");
|
|
ConstantInt *minArgAsInt = dyn_cast<ConstantInt>(minArg);
|
|
assert(minArgAsInt && "Second arg is not a ConstantInt");
|
|
assert(minArgAsInt->getBitWidth() == 1 &&
|
|
"Second argument is not an i1");
|
|
+
|
|
+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0)
|
|
+ Value *nullArg = ii->getArgOperand(2);
|
|
+ assert(nullArg && "Failed to get second argument");
|
|
+ ConstantInt *nullArgAsInt = dyn_cast<ConstantInt>(nullArg);
|
|
+ assert(nullArgAsInt && "Third arg is not a ConstantInt");
|
|
+ assert(nullArgAsInt->getBitWidth() == 1 &&
|
|
+ "Third argument is not an i1");
|
|
+ /* TODO should we do something with the 3rd argument? */
|
|
+#endif
|
|
+
|
|
Value *replacement = NULL;
|
|
IntegerType *intType = dyn_cast<IntegerType>(ii->getType());
|
|
assert(intType && "intrinsic does not have integer return type");
|
|
--
|
|
2.17.0
|
|
|