diff --git a/0001-Fix-generation-of-expressions-from-constant-sequenti.patch b/0001-Fix-generation-of-expressions-from-constant-sequenti.patch deleted file mode 100644 index 4019ec8..0000000 --- a/0001-Fix-generation-of-expressions-from-constant-sequenti.patch +++ /dev/null @@ -1,31 +0,0 @@ -From: Martin Nowack -Date: Sun, 29 Oct 2017 22:02:32 +0100 -Subject: Fix generation of expressions from constant sequential data -Patch-mainline: no - -Signed-off-by: Jiri Slaby ---- - lib/Core/ExecutorUtil.cpp | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/lib/Core/ExecutorUtil.cpp b/lib/Core/ExecutorUtil.cpp -index 53f4c5b85754..4f51ecb6301b 100644 ---- a/lib/Core/ExecutorUtil.cpp -+++ b/lib/Core/ExecutorUtil.cpp -@@ -58,9 +58,11 @@ namespace klee { - return ConstantExpr::create(0, getWidthForLLVMType(c->getType())); - } else if (const ConstantDataSequential *cds = - dyn_cast(c)) { -+ // Handle a vector or array: first element has the smallest address, -+ // the last element the highest - std::vector > kids; -- for (unsigned i = 0, e = cds->getNumElements(); i != e; ++i) { -- ref kid = evalConstant(cds->getElementAsConstant(i), ki); -+ for (unsigned i = cds->getNumElements(); i != 0; --i) { -+ ref kid = evalConstant(cds->getElementAsConstant(i - 1), ki); - kids.push_back(kid); - } - ref res = ConcatExpr::createN(kids.size(), kids.data()); --- -2.15.1 - diff --git a/0001-MergeHandler-remove-unused-closedStateCount.patch b/0001-MergeHandler-remove-unused-closedStateCount.patch deleted file mode 100644 index d6f6bed..0000000 --- a/0001-MergeHandler-remove-unused-closedStateCount.patch +++ /dev/null @@ -1,36 +0,0 @@ -From: Jiri Slaby -Date: Mon, 15 Jan 2018 09:20:32 +0100 -Subject: MergeHandler: remove unused closedStateCount -Patch-mainline: no - -clang 5 reports: -In file included from ../lib/Core/MergeHandler.cpp:10: -../include/klee/MergeHandler.h:81:12: warning: private field 'closedStateCount' is not used [-Wunused-private-field] - unsigned closedStateCount; - ^ - -So fix it by removing the member. - -Signed-off-by: Jiri Slaby ---- - include/klee/MergeHandler.h | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/include/klee/MergeHandler.h b/include/klee/MergeHandler.h -index d374e1684036..0c596825e867 100644 ---- a/include/klee/MergeHandler.h -+++ b/include/klee/MergeHandler.h -@@ -76,10 +76,6 @@ class MergeHandler { - private: - Executor *executor; - -- /// @brief Number of states that are tracked by this MergeHandler, that ran -- /// into a relevant klee_close_merge -- unsigned closedStateCount; -- - /// @brief Mapping the different 'klee_close_merge' calls to the states that ran into - /// them - std::map > --- -2.15.1 - diff --git a/0005-llvm-make-KLEE-compile-against-LLVM-3.8.patch b/0001-llvm-make-KLEE-compile-against-LLVM-3.8.patch similarity index 91% rename from 0005-llvm-make-KLEE-compile-against-LLVM-3.8.patch rename to 0001-llvm-make-KLEE-compile-against-LLVM-3.8.patch index af68906..4d21660 100644 --- a/0005-llvm-make-KLEE-compile-against-LLVM-3.8.patch +++ b/0001-llvm-make-KLEE-compile-against-LLVM-3.8.patch @@ -7,18 +7,18 @@ Signed-off-by: Jiri Slaby --- lib/Core/Executor.cpp | 5 +++++ lib/Core/StatsTracker.cpp | 4 ++++ - lib/Module/IntrinsicCleaner.cpp | 10 +++++++++- - lib/Module/LowerSwitch.cpp | 8 ++++++++ - lib/Module/ModuleUtil.cpp | 39 +++++++++++++++++++++++++++++++++------ - lib/Module/Optimize.cpp | 13 ++++++++++++- - tools/klee/main.cpp | 7 ++++++- + lib/Module/IntrinsicCleaner.cpp | 10 ++++++++- + lib/Module/LowerSwitch.cpp | 8 +++++++ + lib/Module/ModuleUtil.cpp | 39 ++++++++++++++++++++++++++++----- + lib/Module/Optimize.cpp | 13 ++++++++++- + tools/klee/main.cpp | 7 +++++- 7 files changed, 77 insertions(+), 9 deletions(-) diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index 045e353ba932..96d85f503d4f 100644 +index f0781e5b882a..2c7e8d4d52a6 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp -@@ -2135,8 +2135,13 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { +@@ -2210,8 +2210,13 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { !fpWidthToSemantics(right->getWidth())) return terminateStateOnExecError(state, "Unsupported FRem operation"); llvm::APFloat Res(*fpWidthToSemantics(left->getWidth()), left->getAPValue()); @@ -33,10 +33,10 @@ index 045e353ba932..96d85f503d4f 100644 break; } diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp -index 6dc13df86440..e931dcef8b2e 100644 +index f2a989e28439..7881f0e84be5 100644 --- a/lib/Core/StatsTracker.cpp +++ b/lib/Core/StatsTracker.cpp -@@ -629,7 +629,11 @@ static std::vector getSuccs(Instruction *i) { +@@ -637,7 +637,11 @@ static std::vector getSuccs(Instruction *i) { for (succ_iterator it = succ_begin(bb), ie = succ_end(bb); it != ie; ++it) res.push_back(&*(it->begin())); } else { @@ -49,26 +49,26 @@ index 6dc13df86440..e931dcef8b2e 100644 return res; diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp -index 54bda16013b6..2b93319f2615 100644 +index 3729ff82cd9d..e10e886e8915 100644 --- a/lib/Module/IntrinsicCleaner.cpp +++ b/lib/Module/IntrinsicCleaner.cpp -@@ -52,6 +52,10 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) { - for (BasicBlock::iterator i = b.begin(), ie = b.end(); - (i != ie) && (block_split == false);) { +@@ -50,6 +50,10 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) { + unsigned WordSize = DataLayout.getPointerSizeInBits() / 8; + for (BasicBlock::iterator i = b.begin(), ie = b.end(); i != ie;) { IntrinsicInst *ii = dyn_cast(&*i); +#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) + // create a copy of iterator to pass to IRBuilder ctor later + BasicBlock::iterator i_ = i; +#endif - // increment now since LowerIntrinsic deletion makes iterator invalid. - ++i; - if(ii) { -@@ -104,8 +108,12 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) { + // increment now since deletion of instructions makes iterator invalid. + ++i; + if (ii) { +@@ -110,8 +114,12 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) { case Intrinsic::uadd_with_overflow: case Intrinsic::usub_with_overflow: case Intrinsic::umul_with_overflow: { +#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ // ctor needs the iterator, but we already increased our one ++ // ctor needs the iterator, but we already increased ours + IRBuilder<> builder(ii->getParent(), i_); +#else IRBuilder<> builder(ii->getParent(), ii); @@ -76,9 +76,9 @@ index 54bda16013b6..2b93319f2615 100644 +#endif Value *op1 = ii->getArgOperand(0); Value *op2 = ii->getArgOperand(1); - + diff --git a/lib/Module/LowerSwitch.cpp b/lib/Module/LowerSwitch.cpp -index 02f00a3ae94e..7fe9d9768d72 100644 +index 0f4e8b1eb72b..056885219e85 100644 --- a/lib/Module/LowerSwitch.cpp +++ b/lib/Module/LowerSwitch.cpp @@ -64,7 +64,11 @@ void LowerSwitchPass::switchConvert(CaseItr begin, CaseItr end, @@ -248,7 +248,7 @@ index 64e4863f70b3..944f51ef336d 100644 addPass(Passes, createLICMPass()); // Hoist loop invariants addPass(Passes, createGVNPass()); // Remove redundancies diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp -index ea24d89c5aaf..14afce0edf7c 100644 +index ab9dfe286ffb..3d73ae07fcb5 100644 --- a/tools/klee/main.cpp +++ b/tools/klee/main.cpp @@ -291,7 +291,12 @@ KleeHandler::KleeHandler(int argc, char **argv) @@ -266,5 +266,5 @@ index ea24d89c5aaf..14afce0edf7c 100644 // create directory and try to link klee-last if (mkdir(d.c_str(), 0775) == 0) { -- -2.15.1 +2.17.0 diff --git a/0001-llvm37-handle-GetElementPtrInst-Create-s-new-paramet.patch b/0001-llvm37-handle-GetElementPtrInst-Create-s-new-paramet.patch deleted file mode 100644 index 7719e9e..0000000 --- a/0001-llvm37-handle-GetElementPtrInst-Create-s-new-paramet.patch +++ /dev/null @@ -1,72 +0,0 @@ -From: Jiri Slaby -Date: Thu, 15 Jun 2017 15:20:49 +0200 -Subject: llvm37: handle GetElementPtrInst::Create's new parameter -Patch-mainline: no - -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 ---- - include/klee/Config/Version.h | 6 ++++++ - lib/Core/ExternalDispatcher.cpp | 1 + - lib/Module/IntrinsicCleaner.cpp | 12 ++++++++---- - 3 files changed, 15 insertions(+), 4 deletions(-) - -diff --git a/include/klee/Config/Version.h b/include/klee/Config/Version.h -index ccf54ae13092..532051602fe3 100644 ---- a/include/klee/Config/Version.h -+++ b/include/klee/Config/Version.h -@@ -15,6 +15,12 @@ - #define LLVM_VERSION(major, minor) (((major) << 8) | (minor)) - #define LLVM_VERSION_CODE LLVM_VERSION(LLVM_VERSION_MAJOR, LLVM_VERSION_MINOR) - -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) -+# define KLEE_LLVM_GEP_TYPE(x) (x), -+#else -+# define KLEE_LLVM_GEP_TYPE(x) -+#endif -+ - #if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) - # define KLEE_LLVM_CL_VAL_END - #else -diff --git a/lib/Core/ExternalDispatcher.cpp b/lib/Core/ExternalDispatcher.cpp -index 28546915b539..3558049d87cc 100644 ---- a/lib/Core/ExternalDispatcher.cpp -+++ b/lib/Core/ExternalDispatcher.cpp -@@ -324,6 +324,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 b02605208bbb..54bda16013b6 100644 ---- a/lib/Module/IntrinsicCleaner.cpp -+++ b/lib/Module/IntrinsicCleaner.cpp -@@ -82,11 +82,15 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) { - Value *pSrc = CastInst::CreatePointerCast(src, i64p, "vacopy.cast.src", ii); - 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); - } - ii->removeFromParent(); --- -2.15.1 - diff --git a/0002-Fix-getelementptr-for-array-or-vector-indices.patch b/0002-Fix-getelementptr-for-array-or-vector-indices.patch deleted file mode 100644 index 8d0e375..0000000 --- a/0002-Fix-getelementptr-for-array-or-vector-indices.patch +++ /dev/null @@ -1,100 +0,0 @@ -From: Martin Nowack -Date: Sun, 29 Oct 2017 22:06:16 +0100 -Subject: Fix getelementptr for array or vector indices -Patch-mainline: no - -Rewrote code based on: llvm::GEPOperator::accumulateConstantOffset(): -Handle signed offset correctly. - -Signed-off-by: Jiri Slaby ---- - lib/Core/ExecutorUtil.cpp | 51 ++++++++++++++++++++++++----------------------- - 1 file changed, 26 insertions(+), 25 deletions(-) - -diff --git a/lib/Core/ExecutorUtil.cpp b/lib/Core/ExecutorUtil.cpp -index 4f51ecb6301b..92dee5ac3906 100644 ---- a/lib/Core/ExecutorUtil.cpp -+++ b/lib/Core/ExecutorUtil.cpp -@@ -19,18 +19,22 @@ - #include "klee/Internal/Module/KModule.h" - - #include "klee/Internal/Support/ErrorHandling.h" --#include "klee/util/GetElementPtrTypeIterator.h" - --#include "llvm/IR/Function.h" - #include "llvm/IR/Constants.h" -+#include "llvm/IR/DataLayout.h" -+#include "llvm/IR/Function.h" - #include "llvm/IR/Instructions.h" - #include "llvm/IR/Module.h" --#include "llvm/IR/DataLayout.h" -+#include "llvm/IR/Operator.h" -+#if LLVM_VERSION_CODE < LLVM_VERSION(3, 5) -+#include "llvm/Support/GetElementPtrTypeIterator.h" -+#else -+#include "llvm/IR/GetElementPtrTypeIterator.h" -+#endif - #include "llvm/Support/raw_ostream.h" - - #include - --using namespace klee; - using namespace llvm; - - namespace klee { -@@ -188,34 +192,31 @@ namespace klee { - - case Instruction::GetElementPtr: { - ref base = op1->ZExt(Context::get().getPointerWidth()); -- - for (gep_type_iterator ii = gep_type_begin(ce), ie = gep_type_end(ce); - ii != ie; ++ii) { -- ref addend = -- ConstantExpr::alloc(0, Context::get().getPointerWidth()); -- -- if (StructType *st = dyn_cast(*ii)) { -- const StructLayout *sl = kmodule->targetData->getStructLayout(st); -- const ConstantInt *ci = cast(ii.getOperand()); -- -- addend = ConstantExpr::alloc(sl->getElementOffset((unsigned) -- ci->getZExtValue()), -- Context::get().getPointerWidth()); -- } else { -- const SequentialType *set = cast(*ii); -- ref index = -+ ref indexOp = - evalConstant(cast(ii.getOperand()), ki); -- unsigned elementSize = -- kmodule->targetData->getTypeStoreSize(set->getElementType()); -+ if (indexOp->isZero()) -+ continue; - -- index = index->ZExt(Context::get().getPointerWidth()); -- addend = index->Mul(ConstantExpr::alloc(elementSize, -- Context::get().getPointerWidth())); -+ // Handle a struct index, which adds its field offset to the pointer. -+ if (StructType *STy = dyn_cast(*ii)) { -+ unsigned ElementIdx = indexOp->getZExtValue(); -+ const StructLayout *SL = kmodule->targetData->getStructLayout(STy); -+ base = base->Add( -+ ConstantExpr::alloc(APInt(Context::get().getPointerWidth(), -+ SL->getElementOffset(ElementIdx)))); -+ continue; - } - -- base = base->Add(addend); -+ // For array or vector indices, scale the index by the size of the type. -+ // Indices can be negative -+ base = base->Add(indexOp->SExt(Context::get().getPointerWidth()) -+ ->Mul(ConstantExpr::alloc( -+ APInt(Context::get().getPointerWidth(), -+ kmodule->targetData->getTypeAllocSize( -+ ii.getIndexedType()))))); - } -- - return base; - } - --- -2.15.1 - diff --git a/0002-llvm-make-KLEE-compile-against-LLVM-3.7.patch b/0002-llvm-make-KLEE-compile-against-LLVM-3.7.patch deleted file mode 100644 index 9fd1e77..0000000 --- a/0002-llvm-make-KLEE-compile-against-LLVM-3.7.patch +++ /dev/null @@ -1,177 +0,0 @@ -From: =?UTF-8?q?Richard=20Trembeck=C3=BD?= -Date: Thu, 28 Apr 2016 18:27:24 +0200 -Subject: llvm: make KLEE compile against LLVM 3.7 -Patch-mainline: no - -Signed-off-by: Jiri Slaby ---- - include/klee/Internal/Support/FloatEvaluation.h | 7 ++++++ - lib/Module/InstructionInfoTable.cpp | 6 +++++ - lib/Module/ModuleUtil.cpp | 30 +++++++++++++++++++++---- - lib/Module/Optimize.cpp | 4 +++- - lib/Module/RaiseAsm.cpp | 5 ++++- - tools/klee/main.cpp | 1 + - 6 files changed, 47 insertions(+), 6 deletions(-) - -diff --git a/include/klee/Internal/Support/FloatEvaluation.h b/include/klee/Internal/Support/FloatEvaluation.h -index 6d9092f2ea37..436e0dc8152f 100644 ---- a/include/klee/Internal/Support/FloatEvaluation.h -+++ b/include/klee/Internal/Support/FloatEvaluation.h -@@ -132,8 +132,15 @@ inline uint64_t mod(uint64_t l, uint64_t r, unsigned inWidth) { - // determine if l represents NaN - inline bool isNaN(uint64_t l, unsigned inWidth) { - switch( inWidth ) { -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) -+ case FLT_BITS: -+ return std::isnan(UInt64AsFloat(l)); -+ case DBL_BITS: -+ return std::isnan(UInt64AsDouble(l)); -+#else - case FLT_BITS: return llvm::IsNAN( UInt64AsFloat(l) ); - case DBL_BITS: return llvm::IsNAN( UInt64AsDouble(l) ); -+#endif - default: llvm::report_fatal_error("unsupported floating point width"); - } - } -diff --git a/lib/Module/InstructionInfoTable.cpp b/lib/Module/InstructionInfoTable.cpp -index e2f05205a633..3d9bf5ae66af 100644 ---- a/lib/Module/InstructionInfoTable.cpp -+++ b/lib/Module/InstructionInfoTable.cpp -@@ -94,9 +94,15 @@ bool InstructionInfoTable::getInstructionDebugInfo(const llvm::Instruction *I, - const std::string *&File, - unsigned &Line) { - if (MDNode *N = I->getMetadata("dbg")) { -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) -+ DILocation *Loc = cast(N); -+ File = internString(getDSPIPath(*Loc)); -+ Line = Loc->getLine(); -+#else - DILocation Loc(N); - File = internString(getDSPIPath(Loc)); - Line = Loc.getLineNumber(); -+#endif - return true; - } - -diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp -index a86adc98a1b1..b07d3d2fe348 100644 ---- a/lib/Module/ModuleUtil.cpp -+++ b/lib/Module/ModuleUtil.cpp -@@ -258,13 +258,21 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er - Module *Result = 0; - // FIXME: Maybe load bitcode file lazily? Then if we need to link, materialise the module - #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) -- ErrorOr resultErr = parseBitcodeFile(buff.get(), -- composite->getContext()); -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) -+ ErrorOr > resultErr = -+#else -+ ErrorOr resultErr = -+#endif -+ parseBitcodeFile(buff.get(), composite->getContext()); - ec = resultErr.getError(); - if (ec) - errorMessage = ec.message(); - else -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) -+ Result = resultErr->release(); -+#else - Result = resultErr.get(); -+#endif - #else - Result = ParseBitcodeFile(buff.get(), composite->getContext(), - &errorMessage); -@@ -421,7 +429,12 @@ Module *klee::linkWithLibrary(Module *module, - if (magic == sys::fs::file_magic::bitcode) { - Module *Result = 0; - #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) -- ErrorOr ResultErr = parseBitcodeFile(Buffer, Context); -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) -+ ErrorOr > ResultErr = -+#else -+ ErrorOr ResultErr = -+#endif -+ parseBitcodeFile(Buffer, Context); - if ((ec = ResultErr.getError())) { - ErrorMessage = ec.message(); - #else -@@ -432,7 +445,9 @@ Module *klee::linkWithLibrary(Module *module, - ErrorMessage.c_str()); - } - --#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) -+ Result = ResultErr->release(); -+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) - Result = ResultErr.get(); - #endif - -@@ -446,7 +461,10 @@ Module *klee::linkWithLibrary(Module *module, - ErrorMessage.c_str()); - } - -+// unique_ptr owns the Module, we don't have to delete it -+#if LLVM_VERSION_CODE < LLVM_VERSION(3, 7) - delete Result; -+#endif - - } else if (magic == sys::fs::file_magic::archive) { - #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) -@@ -615,7 +633,11 @@ Module *klee::loadModule(LLVMContext &ctx, const std::string &path, std::string - // The module has taken ownership of the MemoryBuffer so release it - // from the std::unique_ptr - buffer->release(); -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) -+ auto module = errorOrModule->release(); -+#else - auto module = *errorOrModule; -+#endif - - if (auto ec = module->materializeAllPermanently()) { - errorMsg = ec.message(); -diff --git a/lib/Module/Optimize.cpp b/lib/Module/Optimize.cpp -index 02ab446a8d63..64e4863f70b3 100644 ---- a/lib/Module/Optimize.cpp -+++ b/lib/Module/Optimize.cpp -@@ -154,7 +154,9 @@ void Optimize(Module *M, const std::string &EntryPoint) { - Passes.add(createVerifierPass()); - - // Add an appropriate DataLayout instance for this module... --#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) -+ // LLVM 3.7+ doesn't have DataLayoutPass anymore. -+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) - DataLayoutPass *dlpass = new DataLayoutPass(); - dlpass->doInitialization(*M); - addPass(Passes, dlpass); -diff --git a/lib/Module/RaiseAsm.cpp b/lib/Module/RaiseAsm.cpp -index 13e4f7d47e58..c597fa2a7b82 100644 ---- a/lib/Module/RaiseAsm.cpp -+++ b/lib/Module/RaiseAsm.cpp -@@ -81,7 +81,10 @@ bool RaiseAsmPass::runOnModule(Module &M) { - klee_warning("Warning: unable to select native target: %s", Err.c_str()); - TLI = 0; - } else { --#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) -+ TM = NativeTarget->createTargetMachine(HostTriple, "", "", TargetOptions()); -+ TLI = TM->getSubtargetImpl(*(M.begin()))->getTargetLowering(); -+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) - TM = NativeTarget->createTargetMachine(HostTriple, "", "", TargetOptions()); - TLI = TM->getSubtargetImpl()->getTargetLowering(); - #else -diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp -index 9bdf06f600ce..ea24d89c5aaf 100644 ---- a/tools/klee/main.cpp -+++ b/tools/klee/main.cpp -@@ -35,6 +35,7 @@ - #include "llvm/Support/CommandLine.h" - #include "llvm/Support/ManagedStatic.h" - #include "llvm/Support/MemoryBuffer.h" -+#include "llvm/Support/Path.h" - #include "llvm/Support/raw_ostream.h" - - #include "llvm/Support/TargetSelect.h" --- -2.15.1 - diff --git a/0007-llvm38-test-change-some-tests.patch b/0002-llvm38-test-change-some-tests.patch similarity index 51% rename from 0007-llvm38-test-change-some-tests.patch rename to 0002-llvm38-test-change-some-tests.patch index af0690b..c1b8437 100644 --- a/0007-llvm38-test-change-some-tests.patch +++ b/0002-llvm38-test-change-some-tests.patch @@ -3,36 +3,31 @@ Date: Wed, 1 Nov 2017 09:25:47 +0100 Subject: llvm38: test, change some tests Patch-mainline: no -alias in LLVM 3.8 has a new format, it adds a AliaseeTy parameter. So +alias in LLVM 3.8 has a new format, it adds an AliaseeTy parameter. So handle this in the tests. +[v2] add comments about what was changed and why + Signed-off-by: Jiri Slaby --- - test/Feature/BitcastAlias.llvm37.ll | 1 + - test/Feature/BitcastAlias.llvm38.ll | 35 +++++++++++++++++++++++++++++++++ - test/Feature/BitcastAliasMD2U.llvm37.ll | 1 + - test/Feature/BitcastAliasMD2U.llvm38.ll | 35 +++++++++++++++++++++++++++++++++ - 4 files changed, 72 insertions(+) - create mode 100644 test/Feature/BitcastAlias.llvm38.ll - create mode 100644 test/Feature/BitcastAliasMD2U.llvm38.ll + test/Feature/BitcastAlias.leq37.ll | 38 ++++++++++++++++++++++++++ + test/Feature/BitcastAlias.ll | 5 ++-- + test/Feature/BitcastAliasMD2U.leq37.ll | 38 ++++++++++++++++++++++++++ + test/Feature/BitcastAliasMD2U.ll | 5 ++-- + 4 files changed, 82 insertions(+), 4 deletions(-) + create mode 100644 test/Feature/BitcastAlias.leq37.ll + create mode 100644 test/Feature/BitcastAliasMD2U.leq37.ll -diff --git a/test/Feature/BitcastAlias.llvm37.ll b/test/Feature/BitcastAlias.llvm37.ll -index 0d6e72604d6b..3b702ba2a6b0 100644 ---- a/test/Feature/BitcastAlias.llvm37.ll -+++ b/test/Feature/BitcastAlias.llvm37.ll -@@ -1,4 +1,5 @@ - ; REQUIRES: geq-llvm-3.7 -+; REQUIRES: lt-llvm-3.8 - ; RUN: llvm-as %s -f -o %t1.bc - ; RUN: rm -rf %t.klee-out - ; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2 -diff --git a/test/Feature/BitcastAlias.llvm38.ll b/test/Feature/BitcastAlias.llvm38.ll +diff --git a/test/Feature/BitcastAlias.leq37.ll b/test/Feature/BitcastAlias.leq37.ll new file mode 100644 -index 000000000000..ff7009b7711b +index 000000000000..e860acb24594 --- /dev/null -+++ b/test/Feature/BitcastAlias.llvm38.ll -@@ -0,0 +1,35 @@ -+; REQUIRES: geq-llvm-3.8 ++++ b/test/Feature/BitcastAlias.leq37.ll +@@ -0,0 +1,38 @@ ++; LLVM 3.7 requires a type as the first argument to 'getelementptr' ++; LLVM 3.7 no longer accepts '*' with a 'call' ++; REQUIRES: geq-llvm-3.7 ++; REQUIRES: lt-llvm-3.8 +; RUN: llvm-as %s -f -o %t1.bc +; RUN: rm -rf %t.klee-out +; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2 @@ -41,7 +36,7 @@ index 000000000000..ff7009b7711b +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" +target triple = "x86_64-unknown-linux-gnu" + -+@foo = alias i32 (i32), i32 (i32)* @__foo ++@foo = alias i32 (i32)* @__foo + +define i32 @__foo(i32 %i) nounwind { +entry: @@ -67,23 +62,38 @@ index 000000000000..ff7009b7711b + %1 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.failstr, i64 0, i64 0)) nounwind + ret i32 0 +} -diff --git a/test/Feature/BitcastAliasMD2U.llvm37.ll b/test/Feature/BitcastAliasMD2U.llvm37.ll -index 12abf09373f8..2332a1968dea 100644 ---- a/test/Feature/BitcastAliasMD2U.llvm37.ll -+++ b/test/Feature/BitcastAliasMD2U.llvm37.ll -@@ -1,4 +1,5 @@ - ; REQUIRES: geq-llvm-3.7 -+; REQUIRES: lt-llvm-3.8 +diff --git a/test/Feature/BitcastAlias.ll b/test/Feature/BitcastAlias.ll +index 5bd301936e13..5111f18e53aa 100644 +--- a/test/Feature/BitcastAlias.ll ++++ b/test/Feature/BitcastAlias.ll +@@ -1,6 +1,7 @@ ++; LLVM 3.8 requires a type as the first argument to 'alias' + ; LLVM 3.7 requires a type as the first argument to 'getelementptr' + ; LLVM 3.7 no longer accepts '*' with a 'call' +-; REQUIRES: geq-llvm-3.7 ++; REQUIRES: geq-llvm-3.8 ; RUN: llvm-as %s -f -o %t1.bc ; RUN: rm -rf %t.klee-out - ; RUN: %klee --output-dir=%t.klee-out -disable-opt -search=nurs:md2u %t1.bc > %t2 -diff --git a/test/Feature/BitcastAliasMD2U.llvm38.ll b/test/Feature/BitcastAliasMD2U.llvm38.ll + ; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2 +@@ -9,7 +10,7 @@ + target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" + target triple = "x86_64-unknown-linux-gnu" + +-@foo = alias i32 (i32)* @__foo ++@foo = alias i32 (i32), i32 (i32)* @__foo + + define i32 @__foo(i32 %i) nounwind { + entry: +diff --git a/test/Feature/BitcastAliasMD2U.leq37.ll b/test/Feature/BitcastAliasMD2U.leq37.ll new file mode 100644 -index 000000000000..f4e41293c347 +index 000000000000..c29ec8a62243 --- /dev/null -+++ b/test/Feature/BitcastAliasMD2U.llvm38.ll -@@ -0,0 +1,35 @@ -+; REQUIRES: geq-llvm-3.8 ++++ b/test/Feature/BitcastAliasMD2U.leq37.ll +@@ -0,0 +1,38 @@ ++; LLVM 3.7 requires a type as the first argument to 'getelementptr' ++; LLVM 3.7 no longer accepts '*' with a 'call' ++; REQUIRES: geq-llvm-3.7 ++; REQUIRES: lt-llvm-3.8 +; RUN: llvm-as %s -f -o %t1.bc +; RUN: rm -rf %t.klee-out +; RUN: %klee --output-dir=%t.klee-out -disable-opt -search=nurs:md2u %t1.bc > %t2 @@ -92,7 +102,7 @@ index 000000000000..f4e41293c347 +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" +target triple = "x86_64-unknown-linux-gnu" + -+@foo = alias i32 (i32), i32 (i32)* @__foo ++@foo = alias i32 (i32)* @__foo + +define i32 @__foo(i32 %i) nounwind { +entry: @@ -118,6 +128,28 @@ index 000000000000..f4e41293c347 + %1 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.failstr, i64 0, i64 0)) nounwind + ret i32 0 +} +diff --git a/test/Feature/BitcastAliasMD2U.ll b/test/Feature/BitcastAliasMD2U.ll +index 7eddd3d6a01c..7ef74a8da43c 100644 +--- a/test/Feature/BitcastAliasMD2U.ll ++++ b/test/Feature/BitcastAliasMD2U.ll +@@ -1,6 +1,7 @@ ++; LLVM 3.8 requires a type as the first argument to 'alias' + ; LLVM 3.7 requires a type as the first argument to 'getelementptr' + ; LLVM 3.7 no longer accepts '*' with a 'call' +-; REQUIRES: geq-llvm-3.7 ++; REQUIRES: geq-llvm-3.8 + ; RUN: llvm-as %s -f -o %t1.bc + ; RUN: rm -rf %t.klee-out + ; RUN: %klee --output-dir=%t.klee-out -disable-opt -search=nurs:md2u %t1.bc > %t2 +@@ -9,7 +10,7 @@ + target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" + target triple = "x86_64-unknown-linux-gnu" + +-@foo = alias i32 (i32)* @__foo ++@foo = alias i32 (i32), i32 (i32)* @__foo + + define i32 @__foo(i32 %i) nounwind { + entry: -- -2.15.1 +2.17.0 diff --git a/0002-llvm50-use-auto-variable-instead-of-SwitchInst-CaseI.patch b/0002-llvm50-use-auto-variable-instead-of-SwitchInst-CaseI.patch deleted file mode 100644 index d27edc4..0000000 --- a/0002-llvm50-use-auto-variable-instead-of-SwitchInst-CaseI.patch +++ /dev/null @@ -1,44 +0,0 @@ -From: Jiri Slaby -Date: Mon, 15 Jan 2018 10:24:48 +0100 -Subject: llvm50: use auto variable instead of SwitchInst::CaseIt -Patch-mainline: no - -llvm50 changed the semantics of SwitchInst::CaseIt and started using -"auto" variable type. So use it here too for all versions. - -Signed-off-by: Jiri Slaby ---- - lib/Core/Executor.cpp | 3 +-- - lib/Module/LowerSwitch.cpp | 2 +- - 2 files changed, 2 insertions(+), 3 deletions(-) - -diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index be92b16a459d..d836598927ce 100644 ---- a/lib/Core/Executor.cpp -+++ b/lib/Core/Executor.cpp -@@ -1553,8 +1553,7 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { - std::map, BasicBlock *> expressionOrder; - - // Iterate through all non-default cases and order them by expressions -- for (SwitchInst::CaseIt i = si->case_begin(), e = si->case_end(); i != e; -- ++i) { -+ for (auto i : si->cases()) { - ref value = evalConstant(i.getCaseValue()); - - BasicBlock *caseSuccessor = i.getCaseSuccessor(); -diff --git a/lib/Module/LowerSwitch.cpp b/lib/Module/LowerSwitch.cpp -index 1a194245a09a..02f00a3ae94e 100644 ---- a/lib/Module/LowerSwitch.cpp -+++ b/lib/Module/LowerSwitch.cpp -@@ -115,7 +115,7 @@ void LowerSwitchPass::processSwitchInst(SwitchInst *SI) { - - CaseVector cases; - -- for (SwitchInst::CaseIt i = SI->case_begin(), e = SI->case_end(); i != e; ++i) -+ for (auto i : SI->cases()) - cases.push_back(SwitchCase(i.getCaseValue(), - i.getCaseSuccessor())); - --- -2.15.1 - diff --git a/0003-Fix-correct-element-order-of-InsertElement-ExtractEl.patch b/0003-Fix-correct-element-order-of-InsertElement-ExtractEl.patch deleted file mode 100644 index 81c636e..0000000 --- a/0003-Fix-correct-element-order-of-InsertElement-ExtractEl.patch +++ /dev/null @@ -1,52 +0,0 @@ -From: Martin Nowack -Date: Sun, 29 Oct 2017 22:12:30 +0100 -Subject: Fix correct element order of InsertElement/ExtractElement -Patch-mainline: no - -Signed-off-by: Jiri Slaby ---- - lib/Core/Executor.cpp | 21 ++++++--------------- - 1 file changed, 6 insertions(+), 15 deletions(-) - -diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index d836598927ce..fd1da6478fb2 100644 ---- a/lib/Core/Executor.cpp -+++ b/lib/Core/Executor.cpp -@@ -2391,15 +2391,11 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { - const unsigned elementCount = vt->getNumElements(); - llvm::SmallVector, 8> elems; - elems.reserve(elementCount); -- for (unsigned i = 0; i < elementCount; ++i) { -- // evalConstant() will use ConcatExpr to build vectors with the -- // zero-th element leftmost (most significant bits), followed -- // by the next element (second leftmost) and so on. This means -- // that we have to adjust the index so we read left to right -- // rather than right to left. -- unsigned bitOffset = EltBits * (elementCount - i - 1); -- elems.push_back(i == iIdx ? newElt -- : ExtractExpr::create(vec, bitOffset, EltBits)); -+ for (unsigned i = elementCount; i != 0; --i) { -+ auto of = i - 1; -+ unsigned bitOffset = EltBits * of; -+ elems.push_back( -+ of == iIdx ? newElt : ExtractExpr::create(vec, bitOffset, EltBits)); - } - - ref Result = ConcatExpr::createN(elementCount, elems.data()); -@@ -2429,12 +2425,7 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { - return; - } - -- // evalConstant() will use ConcatExpr to build vectors with the -- // zero-th element left most (most significant bits), followed -- // by the next element (second left most) and so on. This means -- // that we have to adjust the index so we read left to right -- // rather than right to left. -- unsigned bitOffset = EltBits*(vt->getNumElements() - iIdx -1); -+ unsigned bitOffset = EltBits * iIdx; - ref Result = ExtractExpr::create(vec, bitOffset, EltBits); - bindLocal(ki, state, Result); - break; --- -2.15.1 - diff --git a/0006-llvm-make-KLEE-compile-against-LLVM-3.9.patch b/0003-llvm-make-KLEE-compile-against-LLVM-3.9.patch similarity index 98% rename from 0006-llvm-make-KLEE-compile-against-LLVM-3.9.patch rename to 0003-llvm-make-KLEE-compile-against-LLVM-3.9.patch index 1aac841..0c7a1c4 100644 --- a/0006-llvm-make-KLEE-compile-against-LLVM-3.9.patch +++ b/0003-llvm-make-KLEE-compile-against-LLVM-3.9.patch @@ -15,10 +15,10 @@ Signed-off-by: Jiri Slaby 7 files changed, 98 insertions(+), 5 deletions(-) diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index 96d85f503d4f..d7c3194d9de4 100644 +index 2c7e8d4d52a6..b2178cccefd2 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp -@@ -1308,10 +1308,18 @@ void Executor::executeCall(ExecutionState &state, +@@ -1305,10 +1305,18 @@ void Executor::executeCall(ExecutionState &state, // // Alignment requirements for scalar types is the same as their size if (argWidth > Expr::Int64) { @@ -37,7 +37,7 @@ index 96d85f503d4f..d7c3194d9de4 100644 } } -@@ -1344,10 +1352,18 @@ void Executor::executeCall(ExecutionState &state, +@@ -1341,10 +1349,18 @@ void Executor::executeCall(ExecutionState &state, Expr::Width argWidth = arguments[i]->getWidth(); if (argWidth > Expr::Int64) { @@ -272,7 +272,7 @@ index b8b32e31264a..800cece95e9c 100644 llvm::cl::ParseCommandLineOptions(argc, argv); diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp -index 14afce0edf7c..436651f438d4 100644 +index 3d73ae07fcb5..c0ea4fa54551 100644 --- a/tools/klee/main.cpp +++ b/tools/klee/main.cpp @@ -1132,7 +1132,11 @@ int main(int argc, char **argv, char **envp) { @@ -288,5 +288,5 @@ index 14afce0edf7c..436651f438d4 100644 if (Watchdog) { if (MaxTime==0) { -- -2.15.1 +2.17.0 diff --git a/0003-test-add-versions-of-some-tests-for-LLVM-3.7.patch b/0003-test-add-versions-of-some-tests-for-LLVM-3.7.patch deleted file mode 100644 index f2fbaae..0000000 --- a/0003-test-add-versions-of-some-tests-for-LLVM-3.7.patch +++ /dev/null @@ -1,1619 +0,0 @@ -From: =?UTF-8?q?Richard=20Trembeck=C3=BD?= -Date: Fri, 29 Apr 2016 22:33:41 +0200 -Subject: test: add versions of some tests for LLVM 3.7 -Patch-mainline: no - -Clone some tests to have their 3.7 version. 'call's, 'load's and -'getelementptr's match the new specification in them. - -@andreamattavelli: Fixed test cases: BitCastAlias test cases included -modification to alias specifications that require LLVM 3.8 - -Signed-off-by: Jiri Slaby ---- - test/Concrete/BoolReadWrite.ll | 1 + - test/Concrete/BoolReadWrite.llvm37.ll | 16 + - test/Concrete/ConstantExpr.ll | 1 + - test/Concrete/ConstantExpr.llvm37.ll | 165 +++++ - test/Concrete/FloatingPointOps.ll | 1 + - test/Concrete/FloatingPointOps.llvm37.ll | 680 +++++++++++++++++++++ - test/Concrete/GlobalInitializers.ll | 1 + - test/Concrete/GlobalInitializers.llvm37.ll | 48 ++ - test/Concrete/SimpleStoreAndLoad.ll | 1 + - test/Concrete/SimpleStoreAndLoad.llvm37.ll | 20 + - test/Feature/BitcastAlias.ll | 1 + - test/Feature/BitcastAlias.llvm37.ll | 35 ++ - test/Feature/BitcastAliasMD2U.ll | 1 + - test/Feature/BitcastAliasMD2U.llvm37.ll | 35 ++ - test/Feature/ConstantStruct.ll | 1 + - test/Feature/ConstantStruct.llvm37.ll | 34 ++ - test/Feature/GetElementPtr.ll | 1 + - test/Feature/GetElementPtr.llvm37.ll | 30 + - test/Feature/InsertExtractValue.ll | 1 + - test/Feature/InsertExtractValue.llvm37.ll | 34 ++ - test/Feature/Overflow.ll | 1 + - test/Feature/Overflow.llvm37.ll | 45 ++ - test/Feature/OverflowMul.ll | 1 + - test/Feature/OverflowMul.llvm37.ll | 45 ++ - test/Feature/_utils.llvm37._ll | 71 +++ - test/Intrinsics/objectsize.ll | 1 + - test/Intrinsics/objectsize.llvm37.ll | 36 ++ - test/lit.cfg | 2 +- - .../regression/2007-08-16-invalid-constant-value.c | 1 + - .../2007-08-16-invalid-constant-value.llvm37.c | 33 + - 30 files changed, 1342 insertions(+), 1 deletion(-) - create mode 100644 test/Concrete/BoolReadWrite.llvm37.ll - create mode 100644 test/Concrete/ConstantExpr.llvm37.ll - create mode 100644 test/Concrete/FloatingPointOps.llvm37.ll - create mode 100755 test/Concrete/GlobalInitializers.llvm37.ll - create mode 100644 test/Concrete/SimpleStoreAndLoad.llvm37.ll - create mode 100644 test/Feature/BitcastAlias.llvm37.ll - create mode 100644 test/Feature/BitcastAliasMD2U.llvm37.ll - create mode 100644 test/Feature/ConstantStruct.llvm37.ll - create mode 100644 test/Feature/GetElementPtr.llvm37.ll - create mode 100644 test/Feature/InsertExtractValue.llvm37.ll - create mode 100644 test/Feature/Overflow.llvm37.ll - create mode 100644 test/Feature/OverflowMul.llvm37.ll - create mode 100644 test/Feature/_utils.llvm37._ll - create mode 100644 test/Intrinsics/objectsize.llvm37.ll - create mode 100644 test/regression/2007-08-16-invalid-constant-value.llvm37.c - -diff --git a/test/Concrete/BoolReadWrite.ll b/test/Concrete/BoolReadWrite.ll -index f818ecafacd5..34a50447db99 100644 ---- a/test/Concrete/BoolReadWrite.ll -+++ b/test/Concrete/BoolReadWrite.ll -@@ -1,3 +1,4 @@ -+; REQUIRES: lt-llvm-3.7 - ; RUN: %S/ConcreteTest.py --klee='%klee' --lli=%lli %s - - declare void @print_i1(i1) -diff --git a/test/Concrete/BoolReadWrite.llvm37.ll b/test/Concrete/BoolReadWrite.llvm37.ll -new file mode 100644 -index 000000000000..9141987e97a0 ---- /dev/null -+++ b/test/Concrete/BoolReadWrite.llvm37.ll -@@ -0,0 +1,16 @@ -+; REQUIRES: geq-llvm-3.7 -+; RUN: %S/ConcreteTest.py --klee='%klee' --lli=%lli %s -+ -+declare void @print_i1(i1) -+ -+define i32 @main() { -+ %mem = alloca i1 -+ store i1 1, i1* %mem -+ %v = load i1, i1* %mem -+ br i1 %v, label %ok, label %exit -+ok: -+ call void @print_i1(i1 %v) -+ br label %exit -+exit: -+ ret i32 0 -+} -diff --git a/test/Concrete/ConstantExpr.ll b/test/Concrete/ConstantExpr.ll -index d00c59a637e9..2d8e5bc65721 100644 ---- a/test/Concrete/ConstantExpr.ll -+++ b/test/Concrete/ConstantExpr.ll -@@ -1,3 +1,4 @@ -+; REQUIRES: lt-llvm-3.7 - ; RUN: %S/ConcreteTest.py --klee='%klee' --lli=%lli %s - - ; Most of the test below use the *address* of gInt as part of their computation, -diff --git a/test/Concrete/ConstantExpr.llvm37.ll b/test/Concrete/ConstantExpr.llvm37.ll -new file mode 100644 -index 000000000000..fa634c497a4b ---- /dev/null -+++ b/test/Concrete/ConstantExpr.llvm37.ll -@@ -0,0 +1,165 @@ -+; REQUIRES: geq-llvm-3.7 -+; RUN: %S/ConcreteTest.py --klee='%klee' --lli=%lli %s -+ -+; Most of the test below use the *address* of gInt as part of their computation, -+; and then perform some operation (like x | ~x) which makes the result -+; deterministic. They do, however, assume that the sign bit of the address as a -+; 64-bit value will never be set. -+@gInt = global i32 10 -+@gIntWithConstant = global i32 sub(i32 ptrtoint(i32* @gInt to i32), -+ i32 ptrtoint(i32* @gInt to i32)) -+ -+define void @"test_int_to_ptr"() { -+ %t1 = add i8 ptrtoint(i8* inttoptr(i32 100 to i8*) to i8), 0 -+ %t2 = add i32 ptrtoint(i32* inttoptr(i8 100 to i32*) to i32), 0 -+ %t3 = add i32 ptrtoint(i32* inttoptr(i64 100 to i32*) to i32), 0 -+ %t4 = add i64 ptrtoint(i8* inttoptr(i32 100 to i8*) to i64), 0 -+ -+ call void @print_i8(i8 %t1) -+ call void @print_i32(i32 %t2) -+ call void @print_i32(i32 %t3) -+ call void @print_i64(i64 %t4) -+ -+ ret void -+} -+ -+define void @"test_constant_ops"() { -+ %t1 = add i8 trunc(i64 add(i64 ptrtoint(i32* @gInt to i64), i64 -10) to i8), 10 -+ %t2 = and i64 sub(i64 sext(i32 ptrtoint(i32* @gInt to i32) to i64), i64 ptrtoint(i32* @gInt to i64)), 4294967295 -+ %t3 = and i64 sub(i64 zext(i32 ptrtoint(i32* @gInt to i32) to i64), i64 ptrtoint(i32* @gInt to i64)), 4294967295 -+ -+ %t4 = icmp eq i8 trunc(i64 ptrtoint(i32* @gInt to i64) to i8), %t1 -+ %t5 = zext i1 %t4 to i8 -+ -+ call void @print_i8(i8 %t5) -+ call void @print_i64(i64 %t2) -+ call void @print_i64(i64 %t3) -+ -+ ret void -+} -+ -+define void @"test_logical_ops"() { -+ %t1 = add i32 -10, and(i32 ptrtoint(i32* @gInt to i32), i32 xor(i32 ptrtoint(i32* @gInt to i32), i32 -1)) -+ %t2 = add i32 -10, or(i32 ptrtoint(i32* @gInt to i32), i32 xor(i32 ptrtoint(i32* @gInt to i32), i32 -1)) -+ %t3 = add i32 -10, xor(i32 xor(i32 ptrtoint(i32* @gInt to i32), i32 1024), i32 ptrtoint(i32* @gInt to i32)) -+ -+ call void @print_i32(i32 %t1) -+ call void @print_i32(i32 %t2) -+ call void @print_i32(i32 %t3) -+ -+ %t4 = shl i32 lshr(i32 ptrtoint(i32* @gInt to i32), i32 8), 8 -+ %t5 = shl i32 ashr(i32 ptrtoint(i32* @gInt to i32), i32 8), 8 -+ %t6 = lshr i32 shl(i32 ptrtoint(i32* @gInt to i32), i32 8), 8 -+ -+ %t7 = icmp eq i32 %t4, %t5 -+ %t8 = icmp ne i32 %t4, %t6 -+ -+ %t9 = zext i1 %t7 to i8 -+ %t10 = zext i1 %t8 to i8 -+ -+ call void @print_i8(i8 %t9) -+ call void @print_i8(i8 %t10) -+ -+ ret void -+} -+ -+%test.struct.type = type { i32, i32 } -+@test_struct = global %test.struct.type { i32 0, i32 10 } -+ -+define void @"test_misc"() { -+ ; probability that @gInt == 100 is very very low -+ %t1 = add i32 select(i1 icmp eq (i32* @gInt, i32* inttoptr(i32 100 to i32*)), i32 10, i32 0), 0 -+ call void @print_i32(i32 %t1) -+ -+ %t2 = load i32, i32* getelementptr(%test.struct.type, %test.struct.type* @test_struct, i32 0, i32 1) -+ call void @print_i32(i32 %t2) -+ -+ ret void -+} -+ -+define void @"test_simple_arith"() { -+ %t1 = add i32 add(i32 ptrtoint(i32* @gInt to i32), i32 0), 0 -+ %t2 = add i32 sub(i32 0, i32 ptrtoint(i32* @gInt to i32)), %t1 -+ %t3 = mul i32 mul(i32 ptrtoint(i32* @gInt to i32), i32 10), %t2 -+ -+ call void @print_i32(i32 %t3) -+ -+ ret void -+} -+ -+define void @"test_div_and_mod"() { -+ %t1 = add i32 udiv(i32 ptrtoint(i32* @gInt to i32), i32 13), 0 -+ %t2 = add i32 urem(i32 ptrtoint(i32* @gInt to i32), i32 13), 0 -+ %t3 = add i32 sdiv(i32 ptrtoint(i32* @gInt to i32), i32 13), 0 -+ %t4 = add i32 srem(i32 ptrtoint(i32* @gInt to i32), i32 13), 0 -+ -+ %p = ptrtoint i32* @gInt to i32 -+ -+ %i1 = udiv i32 %p, 13 -+ %i2 = urem i32 %p, 13 -+ %i3 = sdiv i32 %p, 13 -+ %i4 = srem i32 %p, 13 -+ -+ %x1 = sub i32 %t1, %i1 -+ %x2 = sub i32 %t2, %i2 -+ %x3 = sub i32 %t3, %i3 -+ %x4 = sub i32 %t4, %i4 -+ -+ call void @print_i32(i32 %x1) -+ call void @print_i32(i32 %x2) -+ call void @print_i32(i32 %x3) -+ call void @print_i32(i32 %x4) -+ -+ ret void -+} -+ -+define void @test_cmp() { -+ %t1 = add i8 zext(i1 icmp ult (i64 ptrtoint(i32* @gInt to i64), i64 0) to i8), 1 -+ %t2 = add i8 zext(i1 icmp ule (i64 ptrtoint(i32* @gInt to i64), i64 0) to i8), 1 -+ %t3 = add i8 zext(i1 icmp uge (i64 ptrtoint(i32* @gInt to i64), i64 0) to i8), 1 -+ %t4 = add i8 zext(i1 icmp ugt (i64 ptrtoint(i32* @gInt to i64), i64 0) to i8), 1 -+ %t5 = add i8 zext(i1 icmp slt (i64 ptrtoint(i32* @gInt to i64), i64 0) to i8), 1 -+ %t6 = add i8 zext(i1 icmp sle (i64 ptrtoint(i32* @gInt to i64), i64 0) to i8), 1 -+ %t7 = add i8 zext(i1 icmp sge (i64 ptrtoint(i32* @gInt to i64), i64 0) to i8), 1 -+ %t8 = add i8 zext(i1 icmp sgt (i64 ptrtoint(i32* @gInt to i64), i64 0) to i8), 1 -+ %t9 = add i8 zext(i1 icmp eq (i64 ptrtoint(i32* @gInt to i64), i64 10) to i8), 1 -+ %t10 = add i8 zext(i1 icmp ne (i64 ptrtoint(i32* @gInt to i64), i64 10) to i8), 1 -+ -+ call void @print_i1(i8 %t1) -+ call void @print_i1(i8 %t2) -+ call void @print_i1(i8 %t3) -+ call void @print_i1(i8 %t4) -+ call void @print_i1(i8 %t5) -+ call void @print_i1(i8 %t6) -+ call void @print_i1(i8 %t7) -+ call void @print_i1(i8 %t8) -+ call void @print_i1(i8 %t9) -+ call void @print_i1(i8 %t10) -+ -+ ret void -+} -+ -+define i32 @main() { -+ call void @test_simple_arith() -+ -+ call void @test_div_and_mod() -+ -+ call void @test_cmp() -+ -+ call void @test_int_to_ptr() -+ -+ call void @test_constant_ops() -+ -+ call void @test_logical_ops() -+ -+ call void @test_misc() -+ -+ ret i32 0 -+} -+ -+; defined in print_int.c -+declare void @print_i1(i8) -+declare void @print_i8(i8) -+declare void @print_i16(i16) -+declare void @print_i32(i32) -+declare void @print_i64(i64) -diff --git a/test/Concrete/FloatingPointOps.ll b/test/Concrete/FloatingPointOps.ll -index 00d4e877b562..b81a3b8df1f4 100644 ---- a/test/Concrete/FloatingPointOps.ll -+++ b/test/Concrete/FloatingPointOps.ll -@@ -1,3 +1,4 @@ -+; REQUIRES: lt-llvm-3.7 - ; RUN: %S/ConcreteTest.py --klee='%klee' --lli=%lli %s - - ; casting error messages -diff --git a/test/Concrete/FloatingPointOps.llvm37.ll b/test/Concrete/FloatingPointOps.llvm37.ll -new file mode 100644 -index 000000000000..3e21f0f12408 ---- /dev/null -+++ b/test/Concrete/FloatingPointOps.llvm37.ll -@@ -0,0 +1,680 @@ -+; REQUIRES: geq-llvm-3.7 -+; RUN: %S/ConcreteTest.py --klee='%klee' --lli=%lli %s -+ -+; casting error messages -+@.strTrunc = internal constant [15 x i8] c"FPTrunc broken\00" -+@.strExt = internal constant [13 x i8] c"FPExt broken\00" -+@.strFPToUIFlt = internal constant [20 x i8] c"FPToUI float broken\00" -+@.strFPToUIDbl = internal constant [21 x i8] c"FPToUI double broken\00" -+@.strFPToSIFlt = internal constant [20 x i8] c"FPToSI float broken\00" -+@.strFPToSIDbl = internal constant [21 x i8] c"FPToSI double broken\00" -+@.strUIToFPFlt = internal constant [20 x i8] c"UIToFP float broken\00" -+@.strUIToFPDbl = internal constant [21 x i8] c"UIToFP double broken\00" -+@.strSIToFPFlt = internal constant [20 x i8] c"SIToFP float broken\00" -+@.strSIToFPDbl = internal constant [21 x i8] c"SIToFP double broken\00" -+ -+; mathematical operator error messages -+@.strDivFlt = internal constant [18 x i8] c"FDiv float broken\00" -+@.strDivDbl = internal constant [19 x i8] c"FDiv double broken\00" -+@.strRemFlt = internal constant [18 x i8] c"FRem float broken\00" -+@.strRemDbl = internal constant [19 x i8] c"FRem double broken\00" -+@.strAddInt = internal constant [16 x i8] c"Add ints broken\00" -+@.strAddFlt = internal constant [18 x i8] c"Add floats broken\00" -+@.strAddDbl = internal constant [19 x i8] c"Add doubles broken\00" -+@.strSubInt = internal constant [16 x i8] c"Sub ints broken\00" -+@.strSubFlt = internal constant [18 x i8] c"Sub floats broken\00" -+@.strSubDbl = internal constant [19 x i8] c"Sub doubles broken\00" -+@.strMulInt = internal constant [16 x i8] c"Mul ints broken\00" -+@.strMulFlt = internal constant [18 x i8] c"Mul floats broken\00" -+@.strMulDbl = internal constant [19 x i8] c"Mul doubles broken\00" -+ -+; fcmp error messages -+@.strCmpTrFlt = internal constant [19 x i8] c"floats TRUE broken\00" ; fcmp::generic broken msgs -+@.strCmpFaFlt = internal constant [20 x i8] c"floats FALSE broken\00" -+@.strCmpTrDbl = internal constant [19 x i8] c"double TRUE broken\00" -+@.strCmpFaDbl = internal constant [20 x i8] c"double FALSE broken\00" -+@.strCmpEqFlt = internal constant [17 x i8] c"floats == broken\00" ; fcmp::ordered broken msgs -+@.strCmpGeFlt = internal constant [17 x i8] c"floats >= broken\00" -+@.strCmpGtFlt = internal constant [17 x i8] c"floats > broken\00" -+@.strCmpLeFlt = internal constant [17 x i8] c"floats <= broken\00" -+@.strCmpLtFlt = internal constant [17 x i8] c"floats < broken\00" -+@.strCmpNeFlt = internal constant [17 x i8] c"floats != broken\00" -+@.strCmpOrdFlt = internal constant [18 x i8] c"floats ORD broken\00" -+@.strCmpEqDbl = internal constant [18 x i8] c"doubles == broken\00" -+@.strCmpGeDbl = internal constant [18 x i8] c"doubles >= broken\00" -+@.strCmpGtDbl = internal constant [18 x i8] c"doubles > broken\00" -+@.strCmpLeDbl = internal constant [18 x i8] c"doubles <= broken\00" -+@.strCmpLtDbl = internal constant [18 x i8] c"doubles < broken\00" -+@.strCmpNeDbl = internal constant [18 x i8] c"doubles != broken\00" -+@.strCmpOrdDbl = internal constant [19 x i8] c"doubles ORD broken\00" -+@.strCmpEqFltU = internal constant [17 x i8] c"U:floats==broken\00" ; fcmp::unordered broken msgs -+@.strCmpGeFltU = internal constant [17 x i8] c"U:floats>=broken\00" -+@.strCmpGtFltU = internal constant [17 x i8] c"U:floats> broken\00" -+@.strCmpLeFltU = internal constant [17 x i8] c"U:floats<=broken\00" -+@.strCmpLtFltU = internal constant [17 x i8] c"U:floats< broken\00" -+@.strCmpNeFltU = internal constant [17 x i8] c"U:floats!=broken\00" -+@.strCmpUnoFlt = internal constant [20 x i8] c"U:floats UNO broken\00" -+@.strCmpEqDblU = internal constant [18 x i8] c"U:doubles==broken\00" -+@.strCmpGeDblU = internal constant [18 x i8] c"U:doubles>=broken\00" -+@.strCmpGtDblU = internal constant [18 x i8] c"U:doubles> broken\00" -+@.strCmpLeDblU = internal constant [18 x i8] c"U:doubles<=broken\00" -+@.strCmpLtDblU = internal constant [18 x i8] c"U:doubles< broken\00" -+@.strCmpNeDblU = internal constant [18 x i8] c"U:doubles!=broken\00" -+@.strCmpUnoDbl = internal constant [21 x i8] c"U:doubles UNO broken\00" -+ -+@.strWorks = internal constant [20 x i8] c"Everything works!\0D\0A\00" -+@.strNL = internal constant [3 x i8] c"\0D\0A\00" -+ -+declare i32 @printf(i8*, ...) -+declare void @exit(i32) -+ -+; if isOk is false, then print errMsg to stdout and exit(1) -+define void @failCheck(i1 %isOk, i8* %errMsg) { -+entry: -+ %fail = icmp eq i1 %isOk, 0 -+ br i1 %fail, label %failed, label %return -+ -+failed: -+ ; print the error msg -+ %ret = call i32 (i8*, ...) @printf( i8* %errMsg ) -+ -+ ; add a newline to the ostream -+ %nl = getelementptr [3 x i8], [3 x i8]* @.strNL, i32 0, i32 0 -+ %ret2 = call i32 (i8*, ...) @printf( i8* %nl ) -+ -+ ; exit with return value 1 to denote that an error occurred -+ call void @exit( i32 1 ) -+ unreachable -+ -+return: -+ ret void -+} -+ -+; test FPTrunc which casts doubles to floats -+define void @testFPTrunc() { -+entry: -+ %d_addr = alloca double, align 8 -+ store double 8.000000e+00, double* %d_addr -+ %d = load double, double* %d_addr -+ %f = fptrunc double %d to float -+ %matches = fcmp oeq float %f, 8.000000e+00 -+ %err_msg = getelementptr [15 x i8], [15 x i8]* @.strTrunc, i32 0, i32 0 -+ call void @failCheck( i1 %matches, i8* %err_msg ) -+ ret void -+} -+ -+; test FPExt which casts floats to doubles -+define void @testFPExt() { -+entry: -+ %f_addr = alloca float, align 4 -+ store float 8.000000e+00, float* %f_addr -+ %f = load float, float* %f_addr -+ %d = fpext float %f to double -+ %matches = fcmp oeq double %d, 8.000000e+00 -+ %err_msg = getelementptr [13 x i8], [13 x i8]* @.strExt, i32 0, i32 0 -+ call void @failCheck( i1 %matches, i8* %err_msg ) -+ ret void -+} -+ -+; test casting fp to an unsigned int -+define void @testFPToUI() { -+entry: -+ %f_addr = alloca float, align 4 -+ %d_addr = alloca double, align 8 -+ -+ ; test float to UI -+ store float 0x4020333340000000, float* %f_addr; %f = 8.1 -+ %f = load float, float* %f_addr -+ %uf = fptoui float %f to i32 -+ %matchesf = icmp eq i32 %uf, 8 -+ %err_msgf = getelementptr [20 x i8], [20 x i8]* @.strFPToUIFlt, i32 0, i32 0 -+ call void @failCheck( i1 %matchesf, i8* %err_msgf ) -+ -+ ; test double to UI -+ store double 8.100000e+00, double* %d_addr -+ %d = load double, double* %d_addr -+ %ud = fptoui double %d to i32 -+ %matchesd = icmp eq i32 %ud, 8 -+ %err_msgd = getelementptr [21 x i8], [21 x i8]* @.strFPToUIDbl, i32 0, i32 0 -+ call void @failCheck( i1 %matchesd, i8* %err_msgd ) -+ -+ ret void -+} -+ -+; test casting fp to a signed int -+define void @testFPToSI() { -+entry: -+ %f_addr = alloca float, align 4 -+ %d_addr = alloca double, align 8 -+ -+ ; test float 8.1 to signed int -+ store float 0x4020333340000000, float* %f_addr -+ %f = load float, float* %f_addr -+ %sf = fptosi float %f to i32 -+ %matchesf = icmp eq i32 %sf, 8 -+ %err_msgf = getelementptr [20 x i8], [20 x i8]* @.strFPToSIFlt, i32 0, i32 0 -+ call void @failCheck( i1 %matchesf, i8* %err_msgf ) -+ -+ ; test double -8.1 to signed int -+ store double -8.100000e+00, double* %d_addr -+ %d = load double, double* %d_addr -+ %sd = fptosi double %d to i32 -+ %matchesd = icmp eq i32 %sd, -8 -+ %err_msgd = getelementptr [21 x i8], [21 x i8]* @.strFPToSIDbl, i32 0, i32 0 -+ call void @failCheck( i1 %matchesd, i8* %err_msgd ) -+ -+ ret void -+} -+ -+; test casting unsigned int to fp -+define void @testUIToFP() { -+entry: -+ ; unsigned int to float -+ %f = uitofp i32 7 to float -+ %matchesf = fcmp oeq float %f, 7.000000e+00 -+ %err_msgf = getelementptr [20 x i8], [20 x i8]* @.strUIToFPFlt, i32 0, i32 0 -+ call void @failCheck( i1 %matchesf, i8* %err_msgf ) -+ -+ ; unsigned int to double -+ %d = uitofp i32 7 to double -+ %matchesd = fcmp oeq double %d, 7.000000e+00 -+ %err_msgd = getelementptr [21 x i8], [21 x i8]* @.strUIToFPDbl, i32 0, i32 0 -+ call void @failCheck( i1 %matchesd, i8* %err_msgd ) -+ -+ ret void -+} -+ -+; test casting signed int to fp -+define void @testSIToFP() { -+entry: -+ ; signed int to float -+ %f = sitofp i32 -7 to float -+ %matchesf = fcmp oeq float %f, -7.000000e+00 -+ %err_msgf = getelementptr [20 x i8], [20 x i8]* @.strSIToFPFlt, i32 0, i32 0 -+ call void @failCheck( i1 %matchesf, i8* %err_msgf ) -+ -+ ; signed int to double -+ %d = sitofp i32 -7 to double -+ %matchesd = fcmp oeq double %d, -7.000000e+00 -+ %err_msgd = getelementptr [21 x i8], [21 x i8]* @.strSIToFPDbl, i32 0, i32 0 -+ call void @failCheck( i1 %matchesd, i8* %err_msgd ) -+ -+ ret void -+} -+ -+; testing fp division -+define void @testFDiv() { -+entry: -+ %fN_addr = alloca float, align 4 -+ %fD_addr = alloca float, align 4 -+ %dN_addr = alloca double, align 8 -+ %dD_addr = alloca double, align 8 -+ -+ ; float division -+ store float 2.200000e+01, float* %fN_addr -+ store float 4.000000e+00, float* %fD_addr -+ %fN = load float, float* %fN_addr -+ %fD = load float, float* %fD_addr -+ %f = fdiv float %fN, %fD -+ %matchesf = fcmp oeq float %f, 5.500000e+00 -+ %err_msgf = getelementptr [18 x i8], [18 x i8]* @.strDivFlt, i32 0, i32 0 -+ call void @failCheck( i1 %matchesf, i8* %err_msgf ) -+ -+ ; double division -+ store double 2.200000e+01, double* %dN_addr -+ store double -4.000000e+00, double* %dD_addr -+ %dN = load double, double* %dN_addr -+ %dD = load double, double* %dD_addr -+ %d = fdiv double %dN, %dD -+ %matchesd = fcmp oeq double %d, -5.500000e+00 -+ %err_msgd = getelementptr [19 x i8], [19 x i8]* @.strDivDbl, i32 0, i32 0 -+ call void @failCheck( i1 %matchesd, i8* %err_msgd ) -+ -+ ret void -+} -+ -+; testing fp modulo -+define void @testFRem() { -+entry: -+ %fN_addr = alloca float, align 4 -+ %fD_addr = alloca float, align 4 -+ %dN_addr = alloca double, align 8 -+ %dD_addr = alloca double, align 8 -+ -+ ; float modoulo -+ store float 2.200000e+01, float* %fN_addr -+ store float 4.000000e+00, float* %fD_addr -+ %fN = load float, float* %fN_addr -+ %fD = load float, float* %fD_addr -+ %f = frem float %fN, %fD -+ %matchesf = fcmp oeq float %f, 2.000000e+00 -+ %err_msgf = getelementptr [18 x i8], [18 x i8]* @.strRemFlt, i32 0, i32 0 -+ call void @failCheck( i1 %matchesf, i8* %err_msgf ) -+ -+ ; double modulo -+ store double -2.200000e+01, double* %dN_addr -+ store double 4.000000e+00, double* %dD_addr -+ %dN = load double, double* %dN_addr -+ %dD = load double, double* %dD_addr -+ %d = frem double %dN, %dD -+ %matchesd = fcmp oeq double %d, -2.000000e+00 -+ %err_msgd = getelementptr [19 x i8], [19 x i8]* @.strRemDbl, i32 0, i32 0 -+ call void @failCheck( i1 %matchesd, i8* %err_msgd ) -+ -+ ret void -+} -+ -+; test addition -+define void @testAdd() { -+entry: -+ %f1_addr = alloca float, align 4 -+ %f2_addr = alloca float, align 4 -+ %d1_addr = alloca double, align 8 -+ %d2_addr = alloca double, align 8 -+ -+ ; test integer addition (3 + 4) -+ %sumi = add i32 3, 4 -+ %matchesi = icmp eq i32 %sumi, 7 -+ %err_msgi = getelementptr [16 x i8], [16 x i8]* @.strAddInt, i32 0, i32 0 -+ call void @failCheck( i1 %matchesi, i8* %err_msgi ) -+ -+ ; test float addition (3.5 + 4.2) -+ store float 3.500000e+00, float* %f1_addr -+ store float 0x4010CCCCC0000000, float* %f2_addr -+ %f1 = load float, float* %f1_addr -+ %f2 = load float, float* %f2_addr -+ %sumf = fadd float %f1, %f2 -+ %matchesf = fcmp oeq float %sumf, 0x401ECCCCC0000000 -+ %err_msgf = getelementptr [18 x i8], [18 x i8]* @.strAddFlt, i32 0, i32 0 -+ call void @failCheck( i1 %matchesf, i8* %err_msgf ) -+ -+ ; test double addition (3.5 + -4.2) -+ store double 3.500000e+00, double* %d1_addr -+ store double -4.200000e+00, double* %d2_addr -+ %d1 = load double, double* %d1_addr -+ %d2 = load double, double* %d2_addr -+ %sumd = fadd double %d1, %d2 -+ %matchesd = fcmp oeq double %sumd, 0xBFE6666666666668 -+ %err_msgd = getelementptr [19 x i8], [19 x i8]* @.strAddDbl, i32 0, i32 0 -+ call void @failCheck( i1 %matchesd, i8* %err_msgd ) -+ -+ ret void -+} -+ -+; test subtraction -+define void @testSub() { -+entry: -+ %f1_addr = alloca float, align 4 -+ %f2_addr = alloca float, align 4 -+ %d1_addr = alloca double, align 8 -+ %d2_addr = alloca double, align 8 -+ -+ ; test integer subtraction (3 - 4) -+ %subi = sub i32 3, 4 -+ %matchesi = icmp eq i32 %subi, -1 -+ %err_msgi = getelementptr [16 x i8], [16 x i8]* @.strSubInt, i32 0, i32 0 -+ call void @failCheck( i1 %matchesi, i8* %err_msgi ) -+ -+ ; test float subtraction (3.5 - 4.2) -+ store float 3.500000e+00, float* %f1_addr -+ store float 0x4010CCCCC0000000, float* %f2_addr -+ %f1 = load float, float* %f1_addr -+ %f2 = load float, float* %f2_addr -+ %subf = fsub float %f1, %f2 -+ %matchesf = fcmp oeq float %subf, 0xBFE6666600000000 -+ %err_msgf = getelementptr [18 x i8], [18 x i8]* @.strSubFlt, i32 0, i32 0 -+ call void @failCheck( i1 %matchesf, i8* %err_msgf ) -+ -+ ; test double subtraction (3.5 - -4.2) -+ store double 3.500000e+00, double* %d1_addr -+ store double -4.200000e+00, double* %d2_addr -+ %d1 = load double, double* %d1_addr -+ %d2 = load double, double* %d2_addr -+ %subd = fsub double %d1, %d2 -+ %matchesd = fcmp oeq double %subd, 7.700000e+00 -+ %err_msgd = getelementptr [19 x i8], [19 x i8]* @.strSubDbl, i32 0, i32 0 -+ call void @failCheck( i1 %matchesd, i8* %err_msgd ) -+ -+ ret void -+} -+ -+; test multiplication -+define void @testMul() { -+entry: -+ %f1_addr = alloca float, align 4 -+ %f2_addr = alloca float, align 4 -+ %d1_addr = alloca double, align 8 -+ %d2_addr = alloca double, align 8 -+ -+ ; test integer multiplication (3 * 4) -+ %muli = mul i32 3, 4 -+ %matchesi = icmp eq i32 %muli, 12 -+ %err_msgi = getelementptr [16 x i8], [16 x i8]* @.strMulInt, i32 0, i32 0 -+ call void @failCheck( i1 %matchesi, i8* %err_msgi ) -+ -+ ; test float multiplication (3.5 * 4.2) -+ store float 3.500000e+00, float* %f1_addr -+ store float 0x4010CCCCC0000000, float* %f2_addr -+ %f1 = load float, float* %f1_addr -+ %f2 = load float, float* %f2_addr -+ %mulf = fmul float %f1, %f2 -+ %matchesf = fcmp oeq float %mulf, 0x402D666640000000 -+ %err_msgf = getelementptr [18 x i8], [18 x i8]* @.strMulFlt, i32 0, i32 0 -+ call void @failCheck( i1 %matchesf, i8* %err_msgf ) -+ -+ ; test double multiplication (3.5 * -4.2) -+ store double 3.500000e+00, double* %d1_addr -+ store double -4.200000e+00, double* %d2_addr -+ %d1 = load double, double* %d1_addr -+ %d2 = load double, double* %d2_addr -+ %muld = fmul double %d1, %d2 -+ %matchesd = fcmp oeq double %muld, 0xC02D666666666667 -+ %err_msgd = getelementptr [19 x i8], [19 x i8]* @.strMulDbl, i32 0, i32 0 -+ call void @failCheck( i1 %matchesd, i8* %err_msgd ) -+ -+ ret void -+} -+ -+; test float comparisons (ordered) -+define void @testFCmpFOrdered(float %f1, float %f2, i1 %eq, i1 %ge, i1 %gt, i1 %le, i1 %lt, i1 %ne, i1 %ord) { -+entry: -+ ; test fcmp::true -- should always return true -+ %cmp_t = fcmp true float %f1, %f2 -+ %cmp_t_ok = icmp eq i1 %cmp_t, 1 -+ %cmp_t_em = getelementptr [19 x i8], [19 x i8]* @.strCmpTrFlt, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_t_ok, i8* %cmp_t_em ) -+ -+ ; test fcmp::false -- should always return false -+ %cmp_f = fcmp false float %f1, %f2 -+ %cmp_f_ok = icmp eq i1 %cmp_f, 0 -+ %cmp_f_em = getelementptr [20 x i8], [20 x i8]* @.strCmpFaFlt, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_f_ok, i8* %cmp_f_em ) -+ -+ ; test fcmp::ord -- should return true if neither operand is NaN -+ %cmp_o = fcmp ord float %f1, %f2 -+ %cmp_o_ok = icmp eq i1 %cmp_o, %ord -+ %cmp_o_em = getelementptr [18 x i8], [18 x i8]* @.strCmpOrdFlt, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_o_ok, i8* %cmp_o_em ) -+ -+ ; test fcmp::oeq -- should return true if neither operand is a NaN and they are equal -+ %cmp_eq = fcmp oeq float %f1, %f2 -+ %cmp_eq_ok = icmp eq i1 %cmp_eq, %eq -+ %cmp_eq_em = getelementptr [17 x i8], [17 x i8]* @.strCmpEqFlt, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_eq_ok, i8* %cmp_eq_em ) -+ -+ ; test fcmp::oge -- should return true if neither operand is a NaN and the first is greater or equal -+ %cmp_ge = fcmp oge float %f1, %f2 -+ %cmp_ge_ok = icmp eq i1 %cmp_ge, %ge -+ %cmp_ge_em = getelementptr [17 x i8], [17 x i8]* @.strCmpGeFlt, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_ge_ok, i8* %cmp_ge_em ) -+ -+ ; test fcmp::ogt -- should return true if neither operand is a NaN and the first is greater -+ %cmp_gt = fcmp ogt float %f1, %f2 -+ %cmp_gt_ok = icmp eq i1 %cmp_gt, %gt -+ %cmp_gt_em = getelementptr [17 x i8], [17 x i8]* @.strCmpGtFlt, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_gt_ok, i8* %cmp_gt_em ) -+ -+ ; test fcmp::ole -- should return true if neither operand is a NaN and the first is less or equal -+ %cmp_le = fcmp ole float %f1, %f2 -+ %cmp_le_ok = icmp eq i1 %cmp_le, %le -+ %cmp_le_em = getelementptr [17 x i8], [17 x i8]* @.strCmpLeFlt, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_le_ok, i8* %cmp_le_em ) -+ -+ ; test fcmp::olt -- should return true if neither operand is a NaN and the first is less -+ %cmp_lt = fcmp olt float %f1, %f2 -+ %cmp_lt_ok = icmp eq i1 %cmp_lt, %lt -+ %cmp_lt_em = getelementptr [17 x i8], [17 x i8]* @.strCmpLtFlt, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_lt_ok, i8* %cmp_lt_em ) -+ -+ ; test fcmp::one -- should return true if neither operand is a NaN and they are not equal -+ %cmp_ne = fcmp one float %f1, %f2 -+ %cmp_ne_ok = icmp eq i1 %cmp_ne, %ne -+ %cmp_ne_em = getelementptr [17 x i8], [17 x i8]* @.strCmpNeFlt, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_ne_ok, i8* %cmp_ne_em ) -+ -+ ret void -+} -+ -+; test double comparisons (ordered) -+define void @testFCmpDOrdered(double %d1, double %d2, i1 %eq, i1 %ge, i1 %gt, i1 %le, i1 %lt, i1 %ne, i1 %ord) { -+entry: -+ ; test fcmp::true -- should always return true -+ %cmp_t = fcmp true double %d1, %d2 -+ %cmp_t_ok = icmp eq i1 %cmp_t, 1 -+ %cmp_t_em = getelementptr [19 x i8], [19 x i8]* @.strCmpTrDbl, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_t_ok, i8* %cmp_t_em ) -+ -+ ; test fcmp::false -- should always return false -+ %cmp_f = fcmp false double %d1, %d2 -+ %cmp_f_ok = icmp eq i1 %cmp_f, 0 -+ %cmp_f_em = getelementptr [20 x i8], [20 x i8]* @.strCmpFaDbl, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_f_ok, i8* %cmp_f_em ) -+ -+ ; test fcmp::ord -- should return true if neither operand is NaN -+ %cmp_o = fcmp ord double %d1, %d2 -+ %cmp_o_ok = icmp eq i1 %cmp_o, %ord -+ %cmp_o_em = getelementptr [19 x i8], [19 x i8]* @.strCmpOrdDbl, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_o_ok, i8* %cmp_o_em ) -+ -+ ; test fcmp::oeq -- should return true if neither operand is a NaN and they are equal -+ %cmp_eq = fcmp oeq double %d1, %d2 -+ %cmp_eq_ok = icmp eq i1 %cmp_eq, %eq -+ %cmp_eq_em = getelementptr [18 x i8], [18 x i8]* @.strCmpEqDbl, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_eq_ok, i8* %cmp_eq_em ) -+ -+ ; test fcmp::oge -- should return true if neither operand is a NaN and the first is greater or equal -+ %cmp_ge = fcmp oge double %d1, %d2 -+ %cmp_ge_ok = icmp eq i1 %cmp_ge, %ge -+ %cmp_ge_em = getelementptr [18 x i8], [18 x i8]* @.strCmpGeDbl, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_ge_ok, i8* %cmp_ge_em ) -+ -+ ; test fcmp::ogt -- should return true if neither operand is a NaN and the first is greater -+ %cmp_gt = fcmp ogt double %d1, %d2 -+ %cmp_gt_ok = icmp eq i1 %cmp_gt, %gt -+ %cmp_gt_em = getelementptr [18 x i8], [18 x i8]* @.strCmpGtDbl, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_gt_ok, i8* %cmp_gt_em ) -+ -+ ; test fcmp::ole -- should return true if neither operand is a NaN and the first is less or equal -+ %cmp_le = fcmp ole double %d1, %d2 -+ %cmp_le_ok = icmp eq i1 %cmp_le, %le -+ %cmp_le_em = getelementptr [18 x i8], [18 x i8]* @.strCmpLeDbl, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_le_ok, i8* %cmp_le_em ) -+ -+ ; test fcmp::olt -- should return true if neither operand is a NaN and the first is less -+ %cmp_lt = fcmp olt double %d1, %d2 -+ %cmp_lt_ok = icmp eq i1 %cmp_lt, %lt -+ %cmp_lt_em = getelementptr [18 x i8], [18 x i8]* @.strCmpLtDbl, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_lt_ok, i8* %cmp_lt_em ) -+ -+ ; test fcmp::one -- should return true if neither operand is a NaN and they are not equal -+ %cmp_ne = fcmp one double %d1, %d2 -+ %cmp_ne_ok = icmp eq i1 %cmp_ne, %ne -+ %cmp_ne_em = getelementptr [18 x i8], [18 x i8]* @.strCmpNeDbl, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_ne_ok, i8* %cmp_ne_em ) -+ -+ ret void -+} -+ -+; test floating point comparisons (ordered) -+define void @testFCmpBothOrdered(double %d1, double %d2, i1 %eq, i1 %ge, i1 %gt, i1 %le, i1 %lt, i1 %ne, i1 %ord) { -+entry: -+ call void @testFCmpDOrdered( double %d1, double %d2, i1 %eq, i1 %ge, i1 %gt, i1 %le, i1 %lt, i1 %ne, i1 %ord ) -+ -+ %f1 = fptrunc double %d1 to float -+ %f2 = fptrunc double %d2 to float -+ call void @testFCmpFOrdered( float %f1, float %f2, i1 %eq, i1 %ge, i1 %gt, i1 %le, i1 %lt, i1 %ne, i1 %ord ) -+ -+ ret void -+} -+ -+; test float comparisons (unordered) -+define void @testFCmpFUnordered(float %f1, float %f2, i1 %eq, i1 %ge, i1 %gt, i1 %le, i1 %lt, i1 %ne, i1 %uno) { -+entry: -+ ; test fcmp::uno -- should return true if either operand is NaN -+ %cmp_o = fcmp uno float %f1, %f2 -+ %cmp_o_ok = icmp eq i1 %cmp_o, %uno -+ %cmp_o_em = getelementptr [20 x i8], [20 x i8]* @.strCmpUnoFlt, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_o_ok, i8* %cmp_o_em ) -+ -+ ; test fcmp::oeq -- should return true if either operand is a NaN and they are equal -+ %cmp_eq = fcmp ueq float %f1, %f2 -+ %cmp_eq_ok = icmp eq i1 %cmp_eq, %eq -+ %cmp_eq_em = getelementptr [17 x i8], [17 x i8]* @.strCmpEqFltU, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_eq_ok, i8* %cmp_eq_em ) -+ -+ ; test fcmp::oge -- should return true if either operand is a NaN and the first is greater or equal -+ %cmp_ge = fcmp uge float %f1, %f2 -+ %cmp_ge_ok = icmp eq i1 %cmp_ge, %ge -+ %cmp_ge_em = getelementptr [17 x i8], [17 x i8]* @.strCmpGeFltU, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_ge_ok, i8* %cmp_ge_em ) -+ -+ ; test fcmp::ogt -- should return true if either operand is a NaN and the first is greater -+ %cmp_gt = fcmp ugt float %f1, %f2 -+ %cmp_gt_ok = icmp eq i1 %cmp_gt, %gt -+ %cmp_gt_em = getelementptr [17 x i8], [17 x i8]* @.strCmpGtFltU, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_gt_ok, i8* %cmp_gt_em ) -+ -+ ; test fcmp::ole -- should return true if either operand is a NaN and the first is less or equal -+ %cmp_le = fcmp ule float %f1, %f2 -+ %cmp_le_ok = icmp eq i1 %cmp_le, %le -+ %cmp_le_em = getelementptr [17 x i8], [17 x i8]* @.strCmpLeFltU, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_le_ok, i8* %cmp_le_em ) -+ -+ ; test fcmp::olt -- should return true if either operand is a NaN and the first is less -+ %cmp_lt = fcmp ult float %f1, %f2 -+ %cmp_lt_ok = icmp eq i1 %cmp_lt, %lt -+ %cmp_lt_em = getelementptr [17 x i8], [17 x i8]* @.strCmpLtFltU, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_lt_ok, i8* %cmp_lt_em ) -+ -+ ; test fcmp::one -- should return true if either operand is a NaN and they are not equal -+ %cmp_ne = fcmp une float %f1, %f2 -+ %cmp_ne_ok = icmp eq i1 %cmp_ne, %ne -+ %cmp_ne_em = getelementptr [17 x i8], [17 x i8]* @.strCmpNeFltU, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_ne_ok, i8* %cmp_ne_em ) -+ -+ ret void -+} -+ -+; test double comparisons (unordered) -+define void @testFCmpDUnordered(double %d1, double %d2, i1 %eq, i1 %ge, i1 %gt, i1 %le, i1 %lt, i1 %ne, i1 %uno) { -+entry: -+ ; test fcmp::uno -- should return true if either operand is NaN -+ %cmp_o = fcmp uno double %d1, %d2 -+ %cmp_o_ok = icmp eq i1 %cmp_o, %uno -+ %cmp_o_em = getelementptr [21 x i8], [21 x i8]* @.strCmpUnoDbl, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_o_ok, i8* %cmp_o_em ) -+ -+ ; test fcmp::ueq -- should return true if either operand is a NaN and they are equal -+ %cmp_eq = fcmp ueq double %d1, %d2 -+ %cmp_eq_ok = icmp eq i1 %cmp_eq, %eq -+ %cmp_eq_em = getelementptr [18 x i8], [18 x i8]* @.strCmpEqDblU, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_eq_ok, i8* %cmp_eq_em ) -+ -+ ; test fcmp::uge -- should return true if either operand is a NaN and the first is greater or equal -+ %cmp_ge = fcmp uge double %d1, %d2 -+ %cmp_ge_ok = icmp eq i1 %cmp_ge, %ge -+ %cmp_ge_em = getelementptr [18 x i8], [18 x i8]* @.strCmpGeDblU, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_ge_ok, i8* %cmp_ge_em ) -+ -+ ; test fcmp::ugt -- should return true if either operand is a NaN and the first is greater -+ %cmp_gt = fcmp ugt double %d1, %d2 -+ %cmp_gt_ok = icmp eq i1 %cmp_gt, %gt -+ %cmp_gt_em = getelementptr [18 x i8], [18 x i8]* @.strCmpGtDblU, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_gt_ok, i8* %cmp_gt_em ) -+ -+ ; test fcmp::ule -- should return true if either operand is a NaN and the first is less or equal -+ %cmp_le = fcmp ule double %d1, %d2 -+ %cmp_le_ok = icmp eq i1 %cmp_le, %le -+ %cmp_le_em = getelementptr [18 x i8], [18 x i8]* @.strCmpLeDblU, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_le_ok, i8* %cmp_le_em ) -+ -+ ; test fcmp::ult -- should return true if either operand is a NaN and the first is less -+ %cmp_lt = fcmp ult double %d1, %d2 -+ %cmp_lt_ok = icmp eq i1 %cmp_lt, %lt -+ %cmp_lt_em = getelementptr [18 x i8], [18 x i8]* @.strCmpLtDblU, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_lt_ok, i8* %cmp_lt_em ) -+ -+ ; test fcmp::une -- should return true if either operand is a NaN and they are not equal -+ %cmp_ne = fcmp une double %d1, %d2 -+ %cmp_ne_ok = icmp eq i1 %cmp_ne, %ne -+ %cmp_ne_em = getelementptr [18 x i8], [18 x i8]* @.strCmpNeDblU, i32 0, i32 0 -+ call void @failCheck( i1 %cmp_ne_ok, i8* %cmp_ne_em ) -+ -+ ret void -+} -+ -+; test floating point comparisons (unordered) -+define void @testFCmpBothUnordered(double %d1, double %d2, i1 %eq, i1 %ge, i1 %gt, i1 %le, i1 %lt, i1 %ne, i1 %uno) { -+entry: -+ call void @testFCmpDUnordered( double %d1, double %d2, i1 %eq, i1 %ge, i1 %gt, i1 %le, i1 %lt, i1 %ne, i1 %uno ) -+ -+ %f1 = fptrunc double %d1 to float -+ %f2 = fptrunc double %d2 to float -+ call void @testFCmpFUnordered( float %f1, float %f2, i1 %eq, i1 %ge, i1 %gt, i1 %le, i1 %lt, i1 %ne, i1 %uno ) -+ -+ ret void -+} -+ -+; test floating point comparisons (ordered and unordered) -+define void @testFCmpBoth(double %d1, double %d2, i1 %eq, i1 %ge, i1 %gt, i1 %le, i1 %lt, i1 %ne, i1 %ord, i1 %uno) { -+entry: -+ call void @testFCmpBothOrdered( double %d1, double %d2, i1 %eq, i1 %ge, i1 %gt, i1 %le, i1 %lt, i1 %ne, i1 %ord ) -+ call void @testFCmpBothUnordered( double %d1, double %d2, i1 %eq, i1 %ge, i1 %gt, i1 %le, i1 %lt, i1 %ne, i1 %uno ) -+ -+ ret void -+} -+ -+; test floating point comparisons (ordered and unordered) with a variety of real numbers and NaNs as operands -+define void @testFCmp() { -+entry: -+ %x = alloca i64, align 8 -+ %nan = alloca double, align 8 -+ -+ ; test FCmp on some real number inputs -+ call void @testFCmpBoth( double 0.000000e+00, double 0.000000e+00, i1 1, i1 1, i1 0, i1 1, i1 0, i1 0, i1 1, i1 0 ) -+ call void @testFCmpBoth( double 0.000000e+00, double 1.000000e+00, i1 0, i1 0, i1 0, i1 1, i1 1, i1 1, i1 1, i1 0 ) -+ call void @testFCmpBoth( double 1.000000e+00, double 0.000000e+00, i1 0, i1 1, i1 1, i1 0, i1 0, i1 1, i1 1, i1 0 ) -+ -+ ; build NaN -+ %nan_as_i64 = bitcast double* %nan to i64* -+ store i64 -1, i64* %nan_as_i64 -+ -+ ; load two copies of our NaN -+ %nan1 = load double, double* %nan -+ %nan2 = load double, double* %nan -+ -+ ; Warning: NaN comparisons with normal operators is BROKEN in LLVM JIT v2.0. Fixed in v2.1. -+ ; FIXME: Just check against 2.9 and the Unordered checks work, but the ordered ones do not. Should be investigated. -+ ; NaNs do different things depending on ordered vs unordered -+; call void @testFCmpBothOrdered( double %nan1, double 0.000000e+00, i1 0, i1 0, i1 0, i1 0, i1 0, i1 0, i1 0 ) -+; call void @testFCmpBothOrdered( double %nan1, double %nan2, i1 0, i1 0, i1 0, i1 0, i1 0, i1 0, i1 0 ) -+; call void @testFCmpBothUnordered( double %nan1, double 0.000000e+00, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1 ) -+; call void @testFCmpBothUnordered( double %nan1, double %nan2, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1 ) -+ -+ ret void -+} -+ -+; tes all floating point instructions -+define i32 @main() { -+entry: -+ call void @testFPTrunc( ) -+ call void @testFPExt( ) -+ call void @testFPToUI( ) -+ call void @testFPToSI( ) -+ call void @testUIToFP( ) -+ call void @testSIToFP( ) -+ -+ call void @testFDiv( ) -+ call void @testFRem( ) -+ call void @testAdd( ) -+ call void @testSub( ) -+ call void @testMul( ) -+ -+ call void @testFCmp( ) -+ -+ ; everything worked -- print a message saying so -+ %works_msg = getelementptr [20 x i8], [20 x i8]* @.strWorks, i32 0, i32 0 -+ %ret = call i32 (i8*, ...) @printf( i8* %works_msg ) -+ -+ ret i32 0 -+} -diff --git a/test/Concrete/GlobalInitializers.ll b/test/Concrete/GlobalInitializers.ll -index e3657dad19e5..ba7e53eb7cd7 100755 ---- a/test/Concrete/GlobalInitializers.ll -+++ b/test/Concrete/GlobalInitializers.ll -@@ -1,3 +1,4 @@ -+; REQUIRES: lt-llvm-3.7 - ; RUN: %S/ConcreteTest.py --klee='%klee' --lli=%lli %s - - declare void @print_i32(i32) -diff --git a/test/Concrete/GlobalInitializers.llvm37.ll b/test/Concrete/GlobalInitializers.llvm37.ll -new file mode 100755 -index 000000000000..2303a6974712 ---- /dev/null -+++ b/test/Concrete/GlobalInitializers.llvm37.ll -@@ -0,0 +1,48 @@ -+; REQUIRES: geq-llvm-3.7 -+; RUN: %S/ConcreteTest.py --klee='%klee' --lli=%lli %s -+ -+declare void @print_i32(i32) -+ -+%simple = type { i8, i16, i32, i64 } -+@gInt = global i32 2 -+@gInts = global [2 x i32] [ i32 3, i32 5 ] -+@gStruct = global %simple { i8 7, i16 11, i32 13, i64 17 } -+@gZero = global %simple zeroinitializer -+ -+define i32 @main() { -+entry: -+ %addr0 = getelementptr i32, i32* @gInt, i32 0 -+ %addr1 = getelementptr [2 x i32], [2 x i32]* @gInts, i32 0, i32 0 -+ %addr2 = getelementptr [2 x i32], [2 x i32]* @gInts, i32 0, i32 1 -+ %addr3 = getelementptr %simple, %simple* @gStruct, i32 0, i32 0 -+ %addr4 = getelementptr %simple, %simple* @gStruct, i32 0, i32 1 -+ %addr5 = getelementptr %simple, %simple* @gStruct, i32 0, i32 2 -+ %addr6 = getelementptr %simple, %simple* @gStruct, i32 0, i32 3 -+ %addr7 = getelementptr %simple, %simple* @gZero, i32 0, i32 2 -+ %contents0 = load i32, i32* %addr0 -+ %contents1 = load i32, i32* %addr1 -+ %contents2 = load i32, i32* %addr2 -+ %contents3tmp = load i8, i8* %addr3 -+ %contents3 = zext i8 %contents3tmp to i32 -+ %contents4tmp = load i16, i16* %addr4 -+ %contents4 = zext i16 %contents4tmp to i32 -+ %contents5 = load i32, i32* %addr5 -+ %contents6tmp = load i64, i64* %addr6 -+ %contents6 = trunc i64 %contents6tmp to i32 -+ %contents7 = load i32, i32* %addr7 -+ %tmp0 = mul i32 %contents0, %contents1 -+ %tmp1 = mul i32 %tmp0, %contents2 -+ %tmp2 = mul i32 %tmp1, %contents3 -+ %tmp3 = mul i32 %tmp2, %contents4 -+ %tmp4 = mul i32 %tmp3, %contents5 -+ %tmp5 = mul i32 %tmp4, %contents6 -+ %tmp6 = add i32 %tmp5, %contents7 -+ %p = icmp eq i32 %tmp5, 510510 -+ br i1 %p, label %exitTrue, label %exitFalse -+exitTrue: -+ call void @print_i32(i32 1) -+ ret i32 0 -+exitFalse: -+ call void @print_i32(i32 0) -+ ret i32 0 -+} -diff --git a/test/Concrete/SimpleStoreAndLoad.ll b/test/Concrete/SimpleStoreAndLoad.ll -index 1edad0386916..7bb65ea7dfc9 100644 ---- a/test/Concrete/SimpleStoreAndLoad.ll -+++ b/test/Concrete/SimpleStoreAndLoad.ll -@@ -1,3 +1,4 @@ -+; REQUIRES: lt-llvm-3.7 - ; RUN: %S/ConcreteTest.py --klee='%klee' --lli=%lli %s - - declare void @print_i32(i32) -diff --git a/test/Concrete/SimpleStoreAndLoad.llvm37.ll b/test/Concrete/SimpleStoreAndLoad.llvm37.ll -new file mode 100644 -index 000000000000..bd081a4a2bcc ---- /dev/null -+++ b/test/Concrete/SimpleStoreAndLoad.llvm37.ll -@@ -0,0 +1,20 @@ -+; REQUIRES: geq-llvm-3.7 -+; RUN: %S/ConcreteTest.py --klee='%klee' --lli=%lli %s -+ -+declare void @print_i32(i32) -+ -+define i32 @main() { -+entry: -+ %a = alloca i32, i32 4 -+ %tmp1 = getelementptr i32, i32* %a, i32 0 -+ store i32 0, i32* %tmp1 -+ %tmp2 = load i32, i32* %tmp1 -+ %tmp3 = icmp eq i32 %tmp2, 0 -+ br i1 %tmp3, label %exitTrue, label %exitFalse -+exitTrue: -+ call void @print_i32(i32 1) -+ ret i32 0 -+exitFalse: -+ call void @print_i32(i32 0) -+ ret i32 0 -+} -diff --git a/test/Feature/BitcastAlias.ll b/test/Feature/BitcastAlias.ll -index e0e3653feebc..d203e52c4bcb 100644 ---- a/test/Feature/BitcastAlias.ll -+++ b/test/Feature/BitcastAlias.ll -@@ -1,3 +1,4 @@ -+; REQUIRES: lt-llvm-3.7 - ; RUN: llvm-as %s -f -o %t1.bc - ; RUN: rm -rf %t.klee-out - ; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2 -diff --git a/test/Feature/BitcastAlias.llvm37.ll b/test/Feature/BitcastAlias.llvm37.ll -new file mode 100644 -index 000000000000..0d6e72604d6b ---- /dev/null -+++ b/test/Feature/BitcastAlias.llvm37.ll -@@ -0,0 +1,35 @@ -+; REQUIRES: geq-llvm-3.7 -+; RUN: llvm-as %s -f -o %t1.bc -+; RUN: rm -rf %t.klee-out -+; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2 -+; RUN: grep PASS %t2 -+ -+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" -+target triple = "x86_64-unknown-linux-gnu" -+ -+@foo = alias i32 (i32)* @__foo -+ -+define i32 @__foo(i32 %i) nounwind { -+entry: -+ ret i32 %i -+} -+ -+declare i32 @puts(i8*) -+ -+@.passstr = private constant [5 x i8] c"PASS\00", align 1 -+@.failstr = private constant [5 x i8] c"FAIL\00", align 1 -+ -+define i32 @main(i32 %argc, i8** nocapture %argv) nounwind readnone { -+entry: -+ %call = call i32 (i64) bitcast (i32 (i32)* @foo to i32 (i64)*)(i64 52) -+ %r = icmp eq i32 %call, 52 -+ br i1 %r, label %bbtrue, label %bbfalse -+ -+bbtrue: -+ %0 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.passstr, i64 0, i64 0)) nounwind -+ ret i32 0 -+ -+bbfalse: -+ %1 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.failstr, i64 0, i64 0)) nounwind -+ ret i32 0 -+} -diff --git a/test/Feature/BitcastAliasMD2U.ll b/test/Feature/BitcastAliasMD2U.ll -index 24eabaa57c8c..cef8ac5459ca 100644 ---- a/test/Feature/BitcastAliasMD2U.ll -+++ b/test/Feature/BitcastAliasMD2U.ll -@@ -1,3 +1,4 @@ -+; REQUIRES: lt-llvm-3.7 - ; RUN: llvm-as %s -f -o %t1.bc - ; RUN: rm -rf %t.klee-out - ; RUN: %klee --output-dir=%t.klee-out -disable-opt -search=nurs:md2u %t1.bc > %t2 -diff --git a/test/Feature/BitcastAliasMD2U.llvm37.ll b/test/Feature/BitcastAliasMD2U.llvm37.ll -new file mode 100644 -index 000000000000..12abf09373f8 ---- /dev/null -+++ b/test/Feature/BitcastAliasMD2U.llvm37.ll -@@ -0,0 +1,35 @@ -+; REQUIRES: geq-llvm-3.7 -+; RUN: llvm-as %s -f -o %t1.bc -+; RUN: rm -rf %t.klee-out -+; RUN: %klee --output-dir=%t.klee-out -disable-opt -search=nurs:md2u %t1.bc > %t2 -+; RUN: grep PASS %t2 -+ -+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" -+target triple = "x86_64-unknown-linux-gnu" -+ -+@foo = alias i32 (i32)* @__foo -+ -+define i32 @__foo(i32 %i) nounwind { -+entry: -+ ret i32 %i -+} -+ -+declare i32 @puts(i8*) -+ -+@.passstr = private constant [5 x i8] c"PASS\00", align 1 -+@.failstr = private constant [5 x i8] c"FAIL\00", align 1 -+ -+define i32 @main(i32 %argc, i8** nocapture %argv) nounwind readnone { -+entry: -+ %call = call i32 (i64) bitcast (i32 (i32)* @foo to i32 (i64)*)(i64 52) -+ %r = icmp eq i32 %call, 52 -+ br i1 %r, label %bbtrue, label %bbfalse -+ -+bbtrue: -+ %0 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.passstr, i64 0, i64 0)) nounwind -+ ret i32 0 -+ -+bbfalse: -+ %1 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.failstr, i64 0, i64 0)) nounwind -+ ret i32 0 -+} -diff --git a/test/Feature/ConstantStruct.ll b/test/Feature/ConstantStruct.ll -index 4fe6b5d0e041..073544d38d2f 100644 ---- a/test/Feature/ConstantStruct.ll -+++ b/test/Feature/ConstantStruct.ll -@@ -1,3 +1,4 @@ -+; REQUIRES: lt-llvm-3.7 - ; RUN: llvm-as %s -f -o %t1.bc - ; RUN: rm -rf %t.klee-out - ; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2 -diff --git a/test/Feature/ConstantStruct.llvm37.ll b/test/Feature/ConstantStruct.llvm37.ll -new file mode 100644 -index 000000000000..802dfbf74f6e ---- /dev/null -+++ b/test/Feature/ConstantStruct.llvm37.ll -@@ -0,0 +1,34 @@ -+; REQUIRES: geq-llvm-3.7 -+; RUN: llvm-as %s -f -o %t1.bc -+; RUN: rm -rf %t.klee-out -+; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2 -+; RUN: grep PASS %t2 -+ -+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" -+target triple = "x86_64-unknown-linux-gnu" -+ -+%struct.sfoo = type { i32, i64 } -+ -+declare i32 @puts(i8*) -+declare i32 @printf(i8*, ...) -+ -+@.passstr = private constant [5 x i8] c"PASS\00", align 1 -+@.failstr = private constant [5 x i8] c"FAIL\00", align 1 -+ -+define i32 @main(i32 %argc, i8** nocapture %argv) nounwind readnone { -+entry: -+ %f0 = extractvalue %struct.sfoo { i32 3, i64 1 }, 0 -+ %f1 = extractvalue %struct.sfoo { i32 3, i64 1 }, 1 -+ %xf0 = zext i32 %f0 to i64 -+ %f0mf1 = sub i64 %xf0, %f1 -+ %r = icmp eq i64 %f0mf1, 2 -+ br i1 %r, label %bbtrue, label %bbfalse -+ -+bbtrue: -+ %0 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.passstr, i64 0, i64 0)) nounwind -+ ret i32 0 -+ -+bbfalse: -+ %1 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.failstr, i64 0, i64 0)) nounwind -+ ret i32 0 -+} -diff --git a/test/Feature/GetElementPtr.ll b/test/Feature/GetElementPtr.ll -index da94441c685e..43f33e27aaf1 100644 ---- a/test/Feature/GetElementPtr.ll -+++ b/test/Feature/GetElementPtr.ll -@@ -1,3 +1,4 @@ -+; REQUIRES: lt-llvm-3.7 - ; RUN: llvm-as %s -f -o %t1.bc - ; RUN: rm -rf %t.klee-out - ; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2 -diff --git a/test/Feature/GetElementPtr.llvm37.ll b/test/Feature/GetElementPtr.llvm37.ll -new file mode 100644 -index 000000000000..b4c3ea445729 ---- /dev/null -+++ b/test/Feature/GetElementPtr.llvm37.ll -@@ -0,0 +1,30 @@ -+; REQUIRES: geq-llvm-3.7 -+; RUN: llvm-as %s -f -o %t1.bc -+; RUN: rm -rf %t.klee-out -+; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2 -+; RUN: grep PASS %t2 -+ -+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" -+target triple = "x86_64-unknown-linux-gnu" -+ -+declare i32 @puts(i8*) -+ -+@.passstr = private constant [5 x i8] c"PASS\00", align 1 -+@.failstr = private constant [5 x i8] c"FAIL\00", align 1 -+ -+define i32 @main() { -+entry: -+ %addr = alloca i8, align 4 -+ %addrp1 = getelementptr i8, i8* %addr, i32 1 -+ %addrp1m1 = getelementptr i8, i8* %addrp1, i32 -1 -+ %test = icmp eq i8* %addr, %addrp1m1 -+ br i1 %test, label %bbtrue, label %bbfalse -+ -+bbtrue: -+ %0 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.passstr, i64 0, i64 0)) nounwind -+ ret i32 0 -+ -+bbfalse: -+ %1 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.failstr, i64 0, i64 0)) nounwind -+ ret i32 0 -+} -diff --git a/test/Feature/InsertExtractValue.ll b/test/Feature/InsertExtractValue.ll -index 83e8f851ccea..431e14c4225a 100644 ---- a/test/Feature/InsertExtractValue.ll -+++ b/test/Feature/InsertExtractValue.ll -@@ -1,3 +1,4 @@ -+; REQUIRES: lt-llvm-3.7 - ; RUN: llvm-as %s -f -o %t1.bc - ; RUN: rm -rf %t.klee-out - ; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2 -diff --git a/test/Feature/InsertExtractValue.llvm37.ll b/test/Feature/InsertExtractValue.llvm37.ll -new file mode 100644 -index 000000000000..16dcfd9d0002 ---- /dev/null -+++ b/test/Feature/InsertExtractValue.llvm37.ll -@@ -0,0 +1,34 @@ -+; REQUIRES: geq-llvm-3.7 -+; RUN: llvm-as %s -f -o %t1.bc -+; RUN: rm -rf %t.klee-out -+; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2 -+; RUN: grep PASS %t2 -+ -+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" -+target triple = "x86_64-unknown-linux-gnu" -+ -+%struct.sfoo = type { i32, i32 } -+ -+declare i32 @puts(i8*) -+ -+@.passstr = private constant [5 x i8] c"PASS\00", align 1 -+@.failstr = private constant [5 x i8] c"FAIL\00", align 1 -+ -+define i32 @main(i32 %argc, i8** nocapture %argv) nounwind readnone { -+entry: -+ %s0 = insertvalue %struct.sfoo undef, i32 3, 0 -+ %s1 = insertvalue %struct.sfoo %s0, i32 1, 1 -+ %f0 = extractvalue %struct.sfoo %s1, 0 -+ %f1 = extractvalue %struct.sfoo %s1, 1 -+ %f0mf1 = sub i32 %f0, %f1 -+ %r = icmp eq i32 %f0mf1, 2 -+ br i1 %r, label %bbtrue, label %bbfalse -+ -+bbtrue: -+ %0 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.passstr, i64 0, i64 0)) nounwind -+ ret i32 0 -+ -+bbfalse: -+ %1 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.failstr, i64 0, i64 0)) nounwind -+ ret i32 0 -+} -diff --git a/test/Feature/Overflow.ll b/test/Feature/Overflow.ll -index 35dfbd10fe02..2ab047727817 100644 ---- a/test/Feature/Overflow.ll -+++ b/test/Feature/Overflow.ll -@@ -1,3 +1,4 @@ -+; REQUIRES: lt-llvm-3.7 - ; RUN: llvm-as %s -f -o %t1.bc - ; RUN: rm -rf %t.klee-out - ; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2 -diff --git a/test/Feature/Overflow.llvm37.ll b/test/Feature/Overflow.llvm37.ll -new file mode 100644 -index 000000000000..80313a777149 ---- /dev/null -+++ b/test/Feature/Overflow.llvm37.ll -@@ -0,0 +1,45 @@ -+; REQUIRES: geq-llvm-3.7 -+; RUN: llvm-as %s -f -o %t1.bc -+; RUN: rm -rf %t.klee-out -+; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2 -+; RUN: grep PASS %t2 -+ -+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" -+target triple = "x86_64-unknown-linux-gnu" -+ -+declare {i8, i1} @llvm.uadd.with.overflow.i8(i8 %a, i8 %b) -+ -+declare i32 @puts(i8*) -+ -+@.passstr = private constant [5 x i8] c"PASS\00", align 1 -+@.failstr = private constant [5 x i8] c"FAIL\00", align 1 -+ -+define i32 @main() { -+bb0: -+ %s0 = call {i8, i1} @llvm.uadd.with.overflow.i8(i8 0, i8 -1) -+ %v0 = extractvalue {i8, i1} %s0, 0 -+ %c0 = icmp eq i8 %v0, -1 -+ br i1 %c0, label %bb0_1, label %bbfalse -+ -+bb0_1: -+ %o0 = extractvalue {i8, i1} %s0, 1 -+ br i1 %o0, label %bbfalse, label %bb1 -+ -+bb1: -+ %s1 = call {i8, i1} @llvm.uadd.with.overflow.i8(i8 1, i8 -1) -+ %v1 = extractvalue {i8, i1} %s1, 0 -+ %c1 = icmp eq i8 %v1, 0 -+ br i1 %c1, label %bb1_1, label %bbfalse -+ -+bb1_1: -+ %o1 = extractvalue {i8, i1} %s1, 1 -+ br i1 %o1, label %bbtrue, label %bbfalse -+ -+bbtrue: -+ %0 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.passstr, i64 0, i64 0)) nounwind -+ ret i32 0 -+ -+bbfalse: -+ %1 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.failstr, i64 0, i64 0)) nounwind -+ ret i32 0 -+} -diff --git a/test/Feature/OverflowMul.ll b/test/Feature/OverflowMul.ll -index 7026aa74bfbe..1b14d3806cf6 100644 ---- a/test/Feature/OverflowMul.ll -+++ b/test/Feature/OverflowMul.ll -@@ -1,3 +1,4 @@ -+; REQUIRES: lt-llvm-3.7 - ; RUN: llvm-as %s -f -o %t1.bc - ; RUN: rm -rf %t.klee-out - ; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2 -diff --git a/test/Feature/OverflowMul.llvm37.ll b/test/Feature/OverflowMul.llvm37.ll -new file mode 100644 -index 000000000000..8dd93778728a ---- /dev/null -+++ b/test/Feature/OverflowMul.llvm37.ll -@@ -0,0 +1,45 @@ -+; REQUIRES: geq-llvm-3.7 -+; RUN: llvm-as %s -f -o %t1.bc -+; RUN: rm -rf %t.klee-out -+; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2 -+; RUN: grep PASS %t2 -+ -+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" -+target triple = "x86_64-unknown-linux-gnu" -+ -+declare {i8, i1} @llvm.umul.with.overflow.i8(i8 %a, i8 %b) -+ -+declare i32 @puts(i8*) -+ -+@.passstr = private constant [5 x i8] c"PASS\00", align 1 -+@.failstr = private constant [5 x i8] c"FAIL\00", align 1 -+ -+define i32 @main() { -+bb0: -+ %s0 = call {i8, i1} @llvm.umul.with.overflow.i8(i8 1, i8 128) -+ %v0 = extractvalue {i8, i1} %s0, 0 -+ %c0 = icmp eq i8 %v0, 128 -+ br i1 %c0, label %bb0_1, label %bbfalse -+ -+bb0_1: -+ %o0 = extractvalue {i8, i1} %s0, 1 -+ br i1 %o0, label %bbfalse, label %bb1 -+ -+bb1: -+ %s1 = call {i8, i1} @llvm.umul.with.overflow.i8(i8 2, i8 128) -+ %v1 = extractvalue {i8, i1} %s1, 0 -+ %c1 = icmp eq i8 %v1, 0 -+ br i1 %c1, label %bb1_1, label %bbfalse -+ -+bb1_1: -+ %o1 = extractvalue {i8, i1} %s1, 1 -+ br i1 %o1, label %bbtrue, label %bbfalse -+ -+bbtrue: -+ %0 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.passstr, i64 0, i64 0)) nounwind -+ ret i32 0 -+ -+bbfalse: -+ %1 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.failstr, i64 0, i64 0)) nounwind -+ ret i32 0 -+} -diff --git a/test/Feature/_utils.llvm37._ll b/test/Feature/_utils.llvm37._ll -new file mode 100644 -index 000000000000..7114daabb6c2 ---- /dev/null -+++ b/test/Feature/_utils.llvm37._ll -@@ -0,0 +1,71 @@ -+define i32 @util_make_and_i1(i32 %a, i32 %b) { -+ %a_i1 = icmp ne i32 %a, 0 -+ %b_i1 = icmp ne i32 %b, 0 -+ %res_i1 = and i1 %a_i1, %b_i1 -+ %res = zext i1 %res_i1 to i32 -+ ret i32 %res -+} -+ -+define i32 @util_make_or_i1(i32 %a, i32 %b) { -+ %a_i1 = icmp ne i32 %a, 0 -+ %b_i1 = icmp ne i32 %b, 0 -+ %res_i1 = or i1 %a_i1, %b_i1 -+ %res = zext i1 %res_i1 to i32 -+ ret i32 %res -+} -+ -+define i16 @util_make_concat2(i8 %a, i8 %b) { -+ %tmp = alloca i16 -+ %tmp8 = bitcast i16* %tmp to i8* -+ %p0 = getelementptr i8, i8* %tmp8, i32 0 -+ %p1 = getelementptr i8, i8* %tmp8, i32 1 -+ store i8 %b, i8* %p0 -+ store i8 %a, i8* %p1 -+ %concat = load i16, i16* %tmp -+ ret i16 %concat -+} -+ -+define i32 @util_make_concat4(i8 %a, i8 %b, i8 %c, i8 %d) { -+ %tmp = alloca i32 -+ %tmp8 = bitcast i32* %tmp to i8* -+ %p0 = getelementptr i8, i8* %tmp8, i32 0 -+ %p1 = getelementptr i8, i8* %tmp8, i32 1 -+ %p2 = getelementptr i8, i8* %tmp8, i32 2 -+ %p3 = getelementptr i8, i8* %tmp8, i32 3 -+ store i8 %d, i8* %p0 -+ store i8 %c, i8* %p1 -+ store i8 %b, i8* %p2 -+ store i8 %a, i8* %p3 -+ %concat = load i32, i32* %tmp -+ ret i32 %concat -+} -+ -+define i64 @util_make_concat8(i8 %a, i8 %b, i8 %c, i8 %d, -+ i8 %e, i8 %f, i8 %g, i8 %h) { -+ %tmp = alloca i64 -+ %tmp8 = bitcast i64* %tmp to i8* -+ %p0 = getelementptr i8, i8* %tmp8, i32 0 -+ %p1 = getelementptr i8, i8* %tmp8, i32 1 -+ %p2 = getelementptr i8, i8* %tmp8, i32 2 -+ %p3 = getelementptr i8, i8* %tmp8, i32 3 -+ %p4 = getelementptr i8, i8* %tmp8, i32 4 -+ %p5 = getelementptr i8, i8* %tmp8, i32 5 -+ %p6 = getelementptr i8, i8* %tmp8, i32 6 -+ %p7 = getelementptr i8, i8* %tmp8, i32 7 -+ store i8 %h, i8* %p0 -+ store i8 %g, i8* %p1 -+ store i8 %f, i8* %p2 -+ store i8 %e, i8* %p3 -+ store i8 %d, i8* %p4 -+ store i8 %c, i8* %p5 -+ store i8 %b, i8* %p6 -+ store i8 %a, i8* %p7 -+ %concat = load i64, i64* %tmp -+ ret i64 %concat -+} -+ -+define i32 @util_make_select(i32 %cond, i32 %t, i32 %f) { -+ %cond_i1 = icmp ne i32 %cond, 0 -+ %res = select i1 %cond_i1, i32 %t, i32 %f -+ ret i32 %res -+} -diff --git a/test/Intrinsics/objectsize.ll b/test/Intrinsics/objectsize.ll -index 4bb59596ad2f..7ad4b6fc4fad 100644 ---- a/test/Intrinsics/objectsize.ll -+++ b/test/Intrinsics/objectsize.ll -@@ -1,3 +1,4 @@ -+; REQUIRES: lt-llvm-3.7 - ; RUN: %llvmas %s -o=%t.bc - ; RUN: rm -rf %t.klee-out - ; RUN: %klee -exit-on-error --output-dir=%t.klee-out -disable-opt %t.bc -diff --git a/test/Intrinsics/objectsize.llvm37.ll b/test/Intrinsics/objectsize.llvm37.ll -new file mode 100644 -index 000000000000..ba3e706a301a ---- /dev/null -+++ b/test/Intrinsics/objectsize.llvm37.ll -@@ -0,0 +1,36 @@ -+; Unfortunately LLVM 2.9 has a different suffix for the ``llvm.objectsize`` instrinsic -+; so this LLVM IR fails to verify for that version. -+; -+; REQUIRES: geq-llvm-3.7 -+; RUN: %llvmas %s -o=%t.bc -+; RUN: rm -rf %t.klee-out -+; RUN: %klee -exit-on-error --output-dir=%t.klee-out -disable-opt %t.bc -+; ModuleID = 'objectsize.c' -+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" -+target triple = "x86_64-unknown-linux-gnu" -+ -+define i32 @main() nounwind uwtable { -+entry: -+ %a = alloca i8*, align 8 -+ %0 = load i8*, i8** %a, align 8 -+ %1 = call i64 @llvm.objectsize.i64.p0i8(i8* %0, i1 true) -+ %cmp = icmp ne i64 %1, 0 -+ br i1 %cmp, label %abort.block, label %continue.block -+ -+continue.block: -+ %2 = load i8*, i8** %a, align 8 -+ %3 = call i64 @llvm.objectsize.i64.p0i8(i8* %2, i1 false) -+ %cmp1 = icmp ne i64 %3, -1 -+ br i1 %cmp1, label %abort.block, label %exit.block -+ -+exit.block: -+ ret i32 0 -+ -+abort.block: -+ call void @abort() -+ unreachable -+} -+ -+declare i64 @llvm.objectsize.i64.p0i8(i8*, i1) nounwind readnone -+ -+declare void @abort() noreturn nounwind -diff --git a/test/lit.cfg b/test/lit.cfg -index 00b429b697a5..e570f9b227e3 100644 ---- a/test/lit.cfg -+++ b/test/lit.cfg -@@ -161,7 +161,7 @@ if int(config.llvm_version_major) == 2: - - # Add feature for the LLVM version in use, so it can be tested in REQUIRES and - # XFAIL checks. We also add "not-XXX" variants, for the same reason. --known_llvm_versions = set(["3.4", "3.5", "3.6"]) -+known_llvm_versions = set(["3.4", "3.5", "3.6", "3.7", "3.8", "3.9"]) - current_llvm_version = "%s.%s" % (config.llvm_version_major, - config.llvm_version_minor) - config.available_features.add("llvm-" + current_llvm_version) -diff --git a/test/regression/2007-08-16-invalid-constant-value.c b/test/regression/2007-08-16-invalid-constant-value.c -index e0b304f40b01..73fe8689d53c 100644 ---- a/test/regression/2007-08-16-invalid-constant-value.c -+++ b/test/regression/2007-08-16-invalid-constant-value.c -@@ -1,3 +1,4 @@ -+// REQUIRES: lt-llvm-3.7 - // RUN: rm -f %t4.out %t4.err %t4.log - // RUN: %llvmgcc %s -emit-llvm -O2 -c -o %t1.bc - // RUN: llvm-as -f %p/../Feature/_utils._ll -o %t2.bc -diff --git a/test/regression/2007-08-16-invalid-constant-value.llvm37.c b/test/regression/2007-08-16-invalid-constant-value.llvm37.c -new file mode 100644 -index 000000000000..aa6b42ed6b9f ---- /dev/null -+++ b/test/regression/2007-08-16-invalid-constant-value.llvm37.c -@@ -0,0 +1,33 @@ -+// REQUIRES: geq-llvm-3.7 -+// RUN: rm -f %t4.out %t4.err %t4.log -+// RUN: %llvmgcc %s -emit-llvm -O2 -c -o %t1.bc -+// RUN: llvm-as -f %p/../Feature/_utils.llvm37._ll -o %t2.bc -+// RUN: llvm-link %t1.bc %t2.bc -o %t3.bc -+// RUN: rm -rf %t.klee-out -+// RUN: %klee --output-dir=%t.klee-out %t3.bc -+ -+#include -+ -+#include "../Feature/utils.h" -+ -+int main() { -+ unsigned char a; -+ -+ klee_make_symbolic(&a, sizeof a); -+ -+ // demand was firing here because an invalid constant -+ // value was being created when implied value did not -+ // subtract using the proper type (so overflowed into -+ // invalid bits) -+ if (util_make_concat2(a + 0xCD, 0xCD) == 0xABCD) { -+ assert(!klee_is_symbolic(a)); -+ printf("add constant case: %d\n", a); -+ } -+ -+ if (util_make_concat2(0x0B - a, 0xCD) == 0xABCD) { -+ assert(!klee_is_symbolic(a)); -+ printf("sub constant case: %d\n", a); -+ } -+ -+ return 0; -+} --- -2.15.1 - diff --git a/0004-Provide-errno-independent-of-CTYPE_EXTERNALS-being-d.patch b/0004-Provide-errno-independent-of-CTYPE_EXTERNALS-being-d.patch deleted file mode 100644 index 1ffe71f..0000000 --- a/0004-Provide-errno-independent-of-CTYPE_EXTERNALS-being-d.patch +++ /dev/null @@ -1,43 +0,0 @@ -From: Martin Nowack -Date: Tue, 25 Jul 2017 18:04:06 +0200 -Subject: Provide errno independent of CTYPE_EXTERNALS being defined -Patch-mainline: no - -Add support for `errno()` for Darwin as well. - -Signed-off-by: Jiri Slaby ---- - lib/Core/Executor.cpp | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - -diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index fd1da6478fb2..efc59008e542 100644 ---- a/lib/Core/Executor.cpp -+++ b/lib/Core/Executor.cpp -@@ -524,14 +524,20 @@ void Executor::initializeGlobals(ExecutionState &state) { - globalAddresses.insert(std::make_pair(f, addr)); - } - -- // Disabled, we don't want to promote use of live externals. --#ifdef HAVE_CTYPE_EXTERNALS - #ifndef WINDOWS --#ifndef DARWIN -+#ifndef __APPLE__ - /* From /usr/include/errno.h: it [errno] is a per-thread variable. */ - int *errno_addr = __errno_location(); -+#else -+ int *errno_addr = __error(); -+#endif - addExternalObject(state, (void *)errno_addr, sizeof *errno_addr, false); -+#endif - -+ // Disabled, we don't want to promote use of live externals. -+#ifdef HAVE_CTYPE_EXTERNALS -+#ifndef WINDOWS -+#ifndef DARWIN - /* from /usr/include/ctype.h: - These point into arrays of 384, so they can be indexed by any `unsigned - char' value [0,255]; by EOF (-1); or by any `signed char' value --- -2.15.1 - diff --git a/0004-llvm37-handle-getRegisteredOptions.patch b/0004-llvm37-handle-getRegisteredOptions.patch deleted file mode 100644 index 80e7394..0000000 --- a/0004-llvm37-handle-getRegisteredOptions.patch +++ /dev/null @@ -1,33 +0,0 @@ -From: Jiri Slaby -Date: Tue, 10 Oct 2017 14:52:57 +0200 -Subject: llvm37: handle getRegisteredOptions -Patch-mainline: no - -In LLVM 3.7 and later, getRegisteredOptions takes no arguments and -return the map. - -Signed-off-by: Jiri Slaby ---- - lib/Basic/CmdLineOptions.cpp | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/lib/Basic/CmdLineOptions.cpp b/lib/Basic/CmdLineOptions.cpp -index aaba72f4b5b7..3c117db9fa7b 100644 ---- a/lib/Basic/CmdLineOptions.cpp -+++ b/lib/Basic/CmdLineOptions.cpp -@@ -86,8 +86,12 @@ UseAssignmentValidatingSolver("debug-assignment-validating-solver", - cl::init(false)); - - void KCommandLine::HideUnrelatedOptions(cl::OptionCategory &Category) { -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) -+ StringMap &map = cl::getRegisteredOptions(); -+#else - StringMap map; - cl::getRegisteredOptions(map); -+#endif - for (StringMap::iterator i = map.begin(), e = map.end(); i != e; - i++) { - if (i->second->Category != &Category) { --- -2.15.1 - diff --git a/0008-llvm40-handle-different-header-names.patch b/0004-llvm40-handle-different-header-names.patch similarity index 96% rename from 0008-llvm40-handle-different-header-names.patch rename to 0004-llvm40-handle-different-header-names.patch index f8b9e93..1008dc1 100644 --- a/0008-llvm40-handle-different-header-names.patch +++ b/0004-llvm40-handle-different-header-names.patch @@ -14,7 +14,7 @@ Signed-off-by: Jiri Slaby 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/Module/KModule.cpp b/lib/Module/KModule.cpp -index 0439431b3bc8..ff76cd53c895 100644 +index 75e71c0a557f..232cd88fd621 100644 --- a/lib/Module/KModule.cpp +++ b/lib/Module/KModule.cpp @@ -21,7 +21,11 @@ @@ -59,7 +59,7 @@ index ee4af254dae2..8aa070743048 100644 #include "llvm/Support/raw_ostream.h" #include "llvm/Support/Path.h" diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp -index 436651f438d4..07f302a4641f 100644 +index c0ea4fa54551..154a76feb361 100644 --- a/tools/klee/main.cpp +++ b/tools/klee/main.cpp @@ -31,7 +31,6 @@ @@ -84,5 +84,5 @@ index 436651f438d4..07f302a4641f 100644 #include #include -- -2.15.1 +2.17.0 diff --git a/0005-Track-errno-correctly.patch b/0005-Track-errno-correctly.patch deleted file mode 100644 index f4cdacb..0000000 --- a/0005-Track-errno-correctly.patch +++ /dev/null @@ -1,146 +0,0 @@ -From: Martin Nowack -Date: Tue, 25 Jul 2017 22:38:41 +0200 -Subject: Track errno correctly -Patch-mainline: no - -Reduce the time of reading the value of errno -and using it and writing it to the state space. - -Signed-off-by: Jiri Slaby ---- - lib/Core/Executor.cpp | 26 +++++++++++++++++++++++++- - lib/Core/ExternalDispatcher.cpp | 11 ++++++++++- - lib/Core/ExternalDispatcher.h | 2 ++ - lib/Core/Memory.h | 3 +++ - 4 files changed, 40 insertions(+), 2 deletions(-) - -diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index efc59008e542..045e353ba932 100644 ---- a/lib/Core/Executor.cpp -+++ b/lib/Core/Executor.cpp -@@ -531,7 +531,10 @@ void Executor::initializeGlobals(ExecutionState &state) { - #else - int *errno_addr = __error(); - #endif -- addExternalObject(state, (void *)errno_addr, sizeof *errno_addr, false); -+ MemoryObject *errnoObj = -+ addExternalObject(state, (void *)errno_addr, sizeof *errno_addr, false); -+ // Copy values from and to program space explicitly -+ errnoObj->isUserSpecified = true; - #endif - - // Disabled, we don't want to promote use of live externals. -@@ -2999,6 +3002,27 @@ void Executor::callExternalFunction(ExecutionState &state, - return; - } - -+#ifndef WINDOWS -+#ifndef __APPLE__ -+ /* From /usr/include/errno.h: it [errno] is a per-thread variable. */ -+ int *errno_addr = __errno_location(); -+#else -+ int *errno_addr = __error(); -+#endif -+ // Update errno value explicitly -+ ObjectPair result; -+ bool resolved = state.addressSpace.resolveOne( -+ ConstantExpr::create((uint64_t)errno_addr, Expr::Int64), result); -+ if (!resolved) -+ klee_error("Could not resolve memory object for errno"); -+ int error = externalDispatcher->getLastErrno(); -+ if (memcmp(result.second->concreteStore, &error, result.first->size) != 0) { -+ ObjectState *wos = -+ state.addressSpace.getWriteable(result.first, result.second); -+ memcpy(wos->concreteStore, &error, result.first->size); -+ } -+#endif -+ - Type *resultType = target->inst->getType(); - if (resultType != Type::getVoidTy(function->getContext())) { - ref e = ConstantExpr::fromMemory((void*) args, -diff --git a/lib/Core/ExternalDispatcher.cpp b/lib/Core/ExternalDispatcher.cpp -index 6c54d34b82bb..28546915b539 100644 ---- a/lib/Core/ExternalDispatcher.cpp -+++ b/lib/Core/ExternalDispatcher.cpp -@@ -65,6 +65,7 @@ private: - llvm::Module *singleDispatchModule; - std::vector moduleIDs; - std::string &getFreshModuleID(); -+ int lastErrno; - - public: - ExternalDispatcherImpl(llvm::LLVMContext &ctx); -@@ -72,6 +73,7 @@ public: - bool executeCall(llvm::Function *function, llvm::Instruction *i, - uint64_t *args); - void *resolveSymbol(const std::string &name); -+ int getLastErrno(); - }; - - std::string &ExternalDispatcherImpl::getFreshModuleID() { -@@ -114,7 +116,8 @@ void *ExternalDispatcherImpl::resolveSymbol(const std::string &name) { - return addr; - } - --ExternalDispatcherImpl::ExternalDispatcherImpl(LLVMContext &ctx) : ctx(ctx) { -+ExternalDispatcherImpl::ExternalDispatcherImpl(LLVMContext &ctx) -+ : ctx(ctx), lastErrno(0) { - std::string error; - singleDispatchModule = new Module(getFreshModuleID(), ctx); - #if LLVM_VERSION_CODE < LLVM_VERSION(3, 6) -@@ -253,6 +256,8 @@ bool ExternalDispatcherImpl::runProtectedCall(Function *f, uint64_t *args) { - res = false; - } else { - executionEngine->runFunction(f, gvArgs); -+ // Explicitly acquire errno information -+ lastErrno = errno; - res = true; - } - -@@ -346,6 +351,8 @@ Function *ExternalDispatcherImpl::createDispatcher(Function *target, - return dispatcher; - } - -+int ExternalDispatcherImpl::getLastErrno() { return lastErrno; } -+ - ExternalDispatcher::ExternalDispatcher(llvm::LLVMContext &ctx) - : impl(new ExternalDispatcherImpl(ctx)) {} - -@@ -359,4 +366,6 @@ bool ExternalDispatcher::executeCall(llvm::Function *function, - void *ExternalDispatcher::resolveSymbol(const std::string &name) { - return impl->resolveSymbol(name); - } -+ -+int ExternalDispatcher::getLastErrno() { return impl->getLastErrno(); } - } -diff --git a/lib/Core/ExternalDispatcher.h b/lib/Core/ExternalDispatcher.h -index c64dc7d81b93..e407355d6692 100644 ---- a/lib/Core/ExternalDispatcher.h -+++ b/lib/Core/ExternalDispatcher.h -@@ -40,6 +40,8 @@ public: - bool executeCall(llvm::Function *function, llvm::Instruction *i, - uint64_t *args); - void *resolveSymbol(const std::string &name); -+ -+ int getLastErrno(); - }; - } - -diff --git a/lib/Core/Memory.h b/lib/Core/Memory.h -index 4e5c87346917..afb41390d071 100644 ---- a/lib/Core/Memory.h -+++ b/lib/Core/Memory.h -@@ -153,7 +153,10 @@ private: - - const MemoryObject *object; - -+public: - uint8_t *concreteStore; -+ -+private: - // XXX cleanup name of flushMask (its backwards or something) - BitArray *concreteMask; - --- -2.15.1 - diff --git a/0009-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch b/0005-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch similarity index 89% rename from 0009-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch rename to 0005-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch index 9d5e5f8..ef44937 100644 --- a/0009-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch +++ b/0005-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch @@ -9,10 +9,10 @@ Signed-off-by: Jiri Slaby 1 file changed, 9 insertions(+) diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index d7c3194d9de4..19499e1be37d 100644 +index b2178cccefd2..75132e0db71b 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp -@@ -1451,12 +1451,21 @@ static bool isDebugIntrinsic(const Function *f, KModule *KM) { +@@ -1448,12 +1448,21 @@ static bool isDebugIntrinsic(const Function *f, KModule *KM) { static inline const llvm::fltSemantics * fpWidthToSemantics(unsigned width) { switch(width) { @@ -35,5 +35,5 @@ index d7c3194d9de4..19499e1be37d 100644 return 0; } -- -2.15.1 +2.17.0 diff --git a/0006-Declare-klee_get_errno-and-remove-local-declarations.patch b/0006-Declare-klee_get_errno-and-remove-local-declarations.patch deleted file mode 100644 index ffd897c..0000000 --- a/0006-Declare-klee_get_errno-and-remove-local-declarations.patch +++ /dev/null @@ -1,45 +0,0 @@ -From: Martin Nowack -Date: Thu, 12 Oct 2017 17:58:00 +0200 -Subject: Declare klee_get_errno and remove local declarations -Patch-mainline: no - -Signed-off-by: Jiri Slaby ---- - include/klee/klee.h | 3 +++ - runtime/POSIX/fd.c | 6 ------ - 2 files changed, 3 insertions(+), 6 deletions(-) - -diff --git a/include/klee/klee.h b/include/klee/klee.h -index 644c498e94ab..8b9cd2e266d3 100644 ---- a/include/klee/klee.h -+++ b/include/klee/klee.h -@@ -157,6 +157,9 @@ extern "C" { - - /* Merge all paths of the state that went through klee_open_merge */ - void klee_close_merge(); -+ -+ /* Get errno value of the current state */ -+ int klee_get_errno(void); - #ifdef __cplusplus - } - #endif -diff --git a/runtime/POSIX/fd.c b/runtime/POSIX/fd.c -index 6f78c7475000..cf07d1380ef8 100644 ---- a/runtime/POSIX/fd.c -+++ b/runtime/POSIX/fd.c -@@ -29,12 +29,6 @@ - #include - #include - --/* #define DEBUG */ -- --void klee_warning(const char*); --void klee_warning_once(const char*); --int klee_get_errno(void); -- - /* Returns pointer to the symbolic file structure fs the pathname is symbolic */ - static exe_disk_file_t *__get_sym_file(const char *pathname) { - if (!pathname) --- -2.15.1 - diff --git a/0010-llvm40-errorOr-and-similar.patch b/0006-llvm40-errorOr-and-similar.patch similarity index 99% rename from 0010-llvm40-errorOr-and-similar.patch rename to 0006-llvm40-errorOr-and-similar.patch index a4c8db9..a9f89db 100644 --- a/0010-llvm40-errorOr-and-similar.patch +++ b/0006-llvm40-errorOr-and-similar.patch @@ -5,7 +5,7 @@ Patch-mainline: no Signed-off-by: Jiri Slaby --- - lib/Module/ModuleUtil.cpp | 50 ++++++++++++++++++++++++++++++++++++++--------- + lib/Module/ModuleUtil.cpp | 50 ++++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp @@ -124,5 +124,5 @@ index 8aa070743048..ad847de0b368 100644 #else if (auto ec = module->materializeAllPermanently()) { -- -2.15.1 +2.17.0 diff --git a/0007-Add-support-for-modelling-errno_location.patch b/0007-Add-support-for-modelling-errno_location.patch deleted file mode 100644 index f4efbf6..0000000 --- a/0007-Add-support-for-modelling-errno_location.patch +++ /dev/null @@ -1,104 +0,0 @@ -From: Martin Nowack -Date: Thu, 12 Oct 2017 21:57:03 +0200 -Subject: Add support for modelling errno_location -Patch-mainline: no - -Signed-off-by: Jiri Slaby ---- - lib/Core/SpecialFunctionHandler.cpp | 44 +++++++++++++++++++++++++++++++++++-- - lib/Core/SpecialFunctionHandler.h | 1 + - tools/klee/main.cpp | 2 ++ - 3 files changed, 45 insertions(+), 2 deletions(-) - -diff --git a/lib/Core/SpecialFunctionHandler.cpp b/lib/Core/SpecialFunctionHandler.cpp -index a8d6edecdd91..267a262fc133 100644 ---- a/lib/Core/SpecialFunctionHandler.cpp -+++ b/lib/Core/SpecialFunctionHandler.cpp -@@ -91,6 +91,8 @@ static SpecialFunctionHandler::HandlerInfo handlerInfo[] = { - add("klee_define_fixed_object", handleDefineFixedObject, false), - add("klee_get_obj_size", handleGetObjSize, true), - add("klee_get_errno", handleGetErrno, true), -+ add("__errno_location", handleErrnoLocation, true), -+ add("__error", handleErrnoLocation, true), - add("klee_is_symbolic", handleIsSymbolic, true), - add("klee_make_symbolic", handleMakeSymbolic, false), - add("klee_mark_global", handleMarkGlobal, false), -@@ -578,10 +580,48 @@ void SpecialFunctionHandler::handleGetErrno(ExecutionState &state, - // XXX should type check args - assert(arguments.size()==0 && - "invalid number of arguments to klee_get_errno"); -- executor.bindLocal(target, state, -- ConstantExpr::create(errno, Expr::Int32)); -+#ifndef WINDOWS -+#ifndef __APPLE__ -+ int *errno_addr = __errno_location(); -+#else -+ int *errno_addr = __error(); -+#endif -+#else -+ int *errno_addr = nullptr; -+#endif -+ -+ // Retrieve the memory object of the errno variable -+ ObjectPair result; -+ bool resolved = state.addressSpace.resolveOne( -+ ConstantExpr::create((uint64_t)errno_addr, Expr::Int64), result); -+ if (!resolved) -+ executor.terminateStateOnError(state, "Could not resolve address for errno", -+ Executor::User); -+ executor.bindLocal(target, state, result.second->read(0, Expr::Int32)); - } - -+void SpecialFunctionHandler::handleErrnoLocation( -+ ExecutionState &state, KInstruction *target, -+ std::vector > &arguments) { -+ // Returns the address of the errno variable -+ assert(arguments.size() == 0 && -+ "invalid number of arguments to __errno_location"); -+ -+#ifndef WINDOWS -+#ifndef __APPLE__ -+ int *errno_addr = __errno_location(); -+#else -+ int *errno_addr = __error(); -+#endif -+#else -+ int *errno_addr = nullptr; -+#endif -+ executor.bindLocal( -+ target, state, -+ ConstantExpr::create((uint64_t)errno_addr, -+ executor.kmodule->targetData->getTypeSizeInBits( -+ target->inst->getType()))); -+} - void SpecialFunctionHandler::handleCalloc(ExecutionState &state, - KInstruction *target, - std::vector > &arguments) { -diff --git a/lib/Core/SpecialFunctionHandler.h b/lib/Core/SpecialFunctionHandler.h -index 7e58018f8366..b11a49749ccb 100644 ---- a/lib/Core/SpecialFunctionHandler.h -+++ b/lib/Core/SpecialFunctionHandler.h -@@ -107,6 +107,7 @@ namespace klee { - HANDLER(handleDelete); - HANDLER(handleDeleteArray); - HANDLER(handleExit); -+ HANDLER(handleErrnoLocation); - HANDLER(handleAliasFunction); - HANDLER(handleFree); - HANDLER(handleGetErrno); -diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp -index 2b2fe3eb06c8..9bdf06f600ce 100644 ---- a/tools/klee/main.cpp -+++ b/tools/klee/main.cpp -@@ -698,6 +698,8 @@ static const char *modelledExternals[] = { - "_assert", - "__assert_fail", - "__assert_rtn", -+ "__errno_location", -+ "__error", - "calloc", - "_exit", - "exit", --- -2.15.1 - diff --git a/0011-llvm-use-chrono-helpers-from-LLVM-4.0.patch b/0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch similarity index 91% rename from 0011-llvm-use-chrono-helpers-from-LLVM-4.0.patch rename to 0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch index 35e5cb1..c2c4859 100644 --- a/0011-llvm-use-chrono-helpers-from-LLVM-4.0.patch +++ b/0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch @@ -8,11 +8,11 @@ chrono. So switch to that in klee for LLVM 4.0 too. Signed-off-by: Jiri Slaby --- - include/klee/Internal/Support/Timer.h | 8 ++++++++ - include/klee/Internal/System/Time.h | 11 +++++++++++ - lib/Core/StatsTracker.cpp | 24 ++++++++++++++++++++++++ - lib/Support/Time.cpp | 32 ++++++++++++++++++++++++++++++++ - lib/Support/Timer.cpp | 16 ++++++++++++++++ + include/klee/Internal/Support/Timer.h | 8 +++++++ + include/klee/Internal/System/Time.h | 11 +++++++++ + lib/Core/StatsTracker.cpp | 24 ++++++++++++++++++++ + lib/Support/Time.cpp | 32 +++++++++++++++++++++++++++ + lib/Support/Timer.cpp | 16 ++++++++++++++ 5 files changed, 91 insertions(+) diff --git a/include/klee/Internal/Support/Timer.h b/include/klee/Internal/Support/Timer.h @@ -38,7 +38,7 @@ index a422abd027f3..d80ccb31f647 100644 public: WallTimer(); diff --git a/include/klee/Internal/System/Time.h b/include/klee/Internal/System/Time.h -index 14d235364401..feeeed8affa2 100644 +index 220e260c975e..12522c866439 100644 --- a/include/klee/Internal/System/Time.h +++ b/include/klee/Internal/System/Time.h @@ -10,7 +10,13 @@ @@ -48,9 +48,9 @@ index 14d235364401..feeeed8affa2 100644 +#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) +#include + -+#include ++#include "llvm/Support/Chrono.h" +#else - #include + #include "llvm/Support/TimeValue.h" +#endif namespace klee { @@ -69,10 +69,10 @@ index 14d235364401..feeeed8affa2 100644 } diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp -index e931dcef8b2e..c39c7d5bd7ba 100644 +index 7881f0e84be5..0be727fbc346 100644 --- a/lib/Core/StatsTracker.cpp +++ b/lib/Core/StatsTracker.cpp -@@ -282,6 +282,29 @@ void StatsTracker::done() { +@@ -286,6 +286,29 @@ void StatsTracker::done() { void StatsTracker::stepInstruction(ExecutionState &es) { if (OutputIStats) { if (TrackInstructionTime) { @@ -102,7 +102,7 @@ index e931dcef8b2e..c39c7d5bd7ba 100644 static sys::TimeValue lastNowTime(0,0),lastUserTime(0,0); if (lastUserTime.seconds()==0 && lastUserTime.nanoseconds()==0) { -@@ -297,6 +320,7 @@ void StatsTracker::stepInstruction(ExecutionState &es) { +@@ -301,6 +324,7 @@ void StatsTracker::stepInstruction(ExecutionState &es) { lastUserTime = user; lastNowTime = now; } @@ -195,5 +195,5 @@ index da96981079ae..a223b39ada57 100644 + +#endif -- -2.15.1 +2.17.0 diff --git a/0008-Cleanup-test-cases.patch b/0008-Cleanup-test-cases.patch deleted file mode 100644 index 7420458..0000000 --- a/0008-Cleanup-test-cases.patch +++ /dev/null @@ -1,42 +0,0 @@ -From: Martin Nowack -Date: Thu, 12 Oct 2017 21:59:16 +0200 -Subject: Cleanup test cases -Patch-mainline: no - -* remove assert(!errno): errno being 0 cannot be assumed if no error - occured -* added missing header - -Signed-off-by: Jiri Slaby ---- - test/Runtime/POSIX/DirSeek.c | 1 - - test/Runtime/POSIX/Ioctl.c | 1 + - 2 files changed, 1 insertion(+), 1 deletion(-) - -diff --git a/test/Runtime/POSIX/DirSeek.c b/test/Runtime/POSIX/DirSeek.c -index 3908b4e28879..155c80b92d1e 100644 ---- a/test/Runtime/POSIX/DirSeek.c -+++ b/test/Runtime/POSIX/DirSeek.c -@@ -43,7 +43,6 @@ int main(int argc, char **argv) { - // Go to end, then back to 2nd - while (de) - de = readdir(d); -- assert(!errno); - seekdir(d, pos); - assert(telldir(d) == pos); - de = readdir(d); -diff --git a/test/Runtime/POSIX/Ioctl.c b/test/Runtime/POSIX/Ioctl.c -index e8220276f8be..f1caaf77dea2 100644 ---- a/test/Runtime/POSIX/Ioctl.c -+++ b/test/Runtime/POSIX/Ioctl.c -@@ -5,6 +5,7 @@ - #include - #include - #include -+#include - #include - #include - #include --- -2.15.1 - diff --git a/0012-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch b/0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch similarity index 93% rename from 0012-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch rename to 0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch index 24b06a8..bded69b 100644 --- a/0012-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch +++ b/0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch @@ -8,7 +8,7 @@ So handle the type specially whenever needed. Signed-off-by: Jiri Slaby --- include/klee/util/GetElementPtrTypeIterator.h | 4 ++++ - lib/Core/Executor.cpp | 22 +++++++++++++++++++--- + lib/Core/Executor.cpp | 22 ++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/include/klee/util/GetElementPtrTypeIterator.h b/include/klee/util/GetElementPtrTypeIterator.h @@ -27,10 +27,10 @@ index 5fb9f4ec5c2f..bf7cb6ff0bea 100644 CurTy = 0; } diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index 19499e1be37d..093be697c7da 100644 +index 75132e0db71b..1c08870b7a20 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp -@@ -2522,8 +2522,7 @@ void Executor::computeOffsets(KGEPInstruction *kgepi, TypeIt ib, TypeIt ie) { +@@ -2598,8 +2598,7 @@ void Executor::computeOffsets(KGEPInstruction *kgepi, TypeIt ib, TypeIt ie) { uint64_t addend = sl->getElementOffset((unsigned) ci->getZExtValue()); constantOffset = constantOffset->Add(ConstantExpr::alloc(addend, Context::get().getPointerWidth())); @@ -40,7 +40,7 @@ index 19499e1be37d..093be697c7da 100644 uint64_t elementSize = kmodule->targetData->getTypeStoreSize(set->getElementType()); Value *operand = ii.getOperand(); -@@ -2537,7 +2536,24 @@ void Executor::computeOffsets(KGEPInstruction *kgepi, TypeIt ib, TypeIt ie) { +@@ -2613,7 +2612,24 @@ void Executor::computeOffsets(KGEPInstruction *kgepi, TypeIt ib, TypeIt ie) { } else { kgepi->indices.push_back(std::make_pair(index, elementSize)); } @@ -67,5 +67,5 @@ index 19499e1be37d..093be697c7da 100644 } kgepi->offset = constantOffset->getZExtValue(); -- -2.15.1 +2.17.0 diff --git a/0013-llvm40-gep_type_iterator-has-no-operator.patch b/0009-llvm40-gep_type_iterator-has-no-operator.patch similarity index 91% rename from 0013-llvm40-gep_type_iterator-has-no-operator.patch rename to 0009-llvm40-gep_type_iterator-has-no-operator.patch index 6fa15e8..078880f 100644 --- a/0013-llvm40-gep_type_iterator-has-no-operator.patch +++ b/0009-llvm40-gep_type_iterator-has-no-operator.patch @@ -12,10 +12,10 @@ Signed-off-by: Jiri Slaby 1 file changed, 4 insertions(+) diff --git a/lib/Core/ExecutorUtil.cpp b/lib/Core/ExecutorUtil.cpp -index 92dee5ac3906..c9308795804e 100644 +index a352db3339c4..7718ae9d0ccb 100644 --- a/lib/Core/ExecutorUtil.cpp +++ b/lib/Core/ExecutorUtil.cpp -@@ -200,7 +200,11 @@ namespace klee { +@@ -213,7 +213,11 @@ namespace klee { continue; // Handle a struct index, which adds its field offset to the pointer. @@ -28,5 +28,5 @@ index 92dee5ac3906..c9308795804e 100644 const StructLayout *SL = kmodule->targetData->getStructLayout(STy); base = base->Add( -- -2.15.1 +2.17.0 diff --git a/0009-test-fix-Feature-BFSSearcherAndDFSSearcherInterleave.patch b/0009-test-fix-Feature-BFSSearcherAndDFSSearcherInterleave.patch deleted file mode 100644 index a1615e9..0000000 --- a/0009-test-fix-Feature-BFSSearcherAndDFSSearcherInterleave.patch +++ /dev/null @@ -1,35 +0,0 @@ -From: =?UTF-8?q?Julian=20B=C3=BCning?= -Date: Mon, 30 Oct 2017 18:53:40 +0100 -Subject: test: fix Feature/BFSSearcherAndDFSSearcherInterleaved.c -Patch-mainline: no - -To use explicit enumeration of possible strings instead of CHECK-SAME -(does not work as intended with LLVM >= 3.7). - -Signed-off-by: Jiri Slaby ---- - test/Feature/BFSSearcherAndDFSSearcherInterleaved.c | 10 ++-------- - 1 file changed, 2 insertions(+), 8 deletions(-) - -diff --git a/test/Feature/BFSSearcherAndDFSSearcherInterleaved.c b/test/Feature/BFSSearcherAndDFSSearcherInterleaved.c -index 9cc11b709bbe..3dd5b4d59fe4 100644 ---- a/test/Feature/BFSSearcherAndDFSSearcherInterleaved.c -+++ b/test/Feature/BFSSearcherAndDFSSearcherInterleaved.c -@@ -38,12 +38,6 @@ int main() { - } - } - -- // exactly 4 characters -- // CHECK: {{^[A-D]{4}$}} -- -- // for each of A, B, C and D: occurs exactly once -- // CHECK-SAME: {{^[B-D]*A[B-D]*$}} -- // CHECK-SAME: {{^[A,C-D]*B[A,C-D]*$}} -- // CHECK-SAME: {{^[A-B,D]*C[A-B,D]*$}} -- // CHECK-SAME: {{^[A-C]*D[A-C]*$}} -+ // exactly 4 characters, each of A, B, C and D occur exactly once -+ // CHECK: {{^(ABCD|ABDC|ACBD|ACDB|ADBC|ADCB|BACD|BADC|BCAD|BCDA|BDAC|BDCA|CABD|CADB|CBAD|CBDA|CDAB|CDBA|DABC|DACB|DBAC|DBCA|DCAB|DCBA)$}} - } --- -2.15.1 - diff --git a/0014-llvm50-avoid-on-function-arg_begin.patch b/0010-llvm50-avoid-on-function-arg_begin.patch similarity index 97% rename from 0014-llvm50-avoid-on-function-arg_begin.patch rename to 0010-llvm50-avoid-on-function-arg_begin.patch index 7e38978..89e5783 100644 --- a/0014-llvm50-avoid-on-function-arg_begin.patch +++ b/0010-llvm50-avoid-on-function-arg_begin.patch @@ -18,7 +18,7 @@ Signed-off-by: Jiri Slaby 1 file changed, 8 insertions(+) diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp -index 07f302a4641f..aeed018631ea 100644 +index 154a76feb361..def83b584167 100644 --- a/tools/klee/main.cpp +++ b/tools/klee/main.cpp @@ -658,7 +658,11 @@ static int initEnv(Module *mainModule) { @@ -46,5 +46,5 @@ index 07f302a4641f..aeed018631ea 100644 args.push_back(Constant::getNullValue(ft->getParamType(4))); // app_fini args.push_back(Constant::getNullValue(ft->getParamType(5))); // rtld_fini -- -2.15.1 +2.17.0 diff --git a/0015-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch b/0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch similarity index 99% rename from 0015-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch rename to 0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch index eeab4f4..3584369 100644 --- a/0015-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch +++ b/0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch @@ -28,5 +28,5 @@ index f73d1614c250..5433d9211ead 100644 } } -- -2.15.1 +2.17.0 diff --git a/0016-llvm50-handle-getOrInsertFunction-terminator.patch b/0012-llvm50-handle-getOrInsertFunction-terminator.patch similarity index 91% rename from 0016-llvm50-handle-getOrInsertFunction-terminator.patch rename to 0012-llvm50-handle-getOrInsertFunction-terminator.patch index ccfd4b3..bf02382 100644 --- a/0016-llvm50-handle-getOrInsertFunction-terminator.patch +++ b/0012-llvm50-handle-getOrInsertFunction-terminator.patch @@ -12,9 +12,9 @@ Signed-off-by: Jiri Slaby --- include/klee/Config/Version.h | 6 ++++++ lib/Module/Checks.cpp | 8 ++++---- - lib/Module/IntrinsicCleaner.cpp | 2 +- + lib/Module/IntrinsicCleaner.cpp | 3 ++- tools/klee/main.cpp | 20 ++++++++++---------- - 4 files changed, 21 insertions(+), 15 deletions(-) + 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/include/klee/Config/Version.h b/include/klee/Config/Version.h index 532051602fe3..a02ce28baaae 100644 @@ -58,20 +58,21 @@ index aac63e1d9854..406b3045e527 100644 } diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp -index 2b93319f2615..c00c77699e18 100644 +index e10e886e8915..d4f93bdc591e 100644 --- a/lib/Module/IntrinsicCleaner.cpp +++ b/lib/Module/IntrinsicCleaner.cpp -@@ -208,7 +208,7 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) { +@@ -214,7 +214,8 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) { + // Intrisic instruction "llvm.trap" found. Directly lower it to // a call of the abort() function. Function *F = cast( - M.getOrInsertFunction( -- "abort", Type::getVoidTy(ctx), NULL)); -+ "abort", Type::getVoidTy(ctx) KLEE_LLVM_GOIF_TERMINATOR)); +- M.getOrInsertFunction("abort", Type::getVoidTy(ctx), NULL)); ++ M.getOrInsertFunction("abort", Type::getVoidTy(ctx) ++ KLEE_LLVM_GOIF_TERMINATOR)); F->setDoesNotReturn(); F->setDoesNotThrow(); diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp -index aeed018631ea..02748fbc0ee5 100644 +index def83b584167..ff87d210b863 100644 --- a/tools/klee/main.cpp +++ b/tools/klee/main.cpp @@ -678,8 +678,8 @@ static int initEnv(Module *mainModule) { @@ -115,5 +116,5 @@ index aeed018631ea..02748fbc0ee5 100644 f = mainModule->getFunction("__ctype_get_mb_cur_max"); -- -2.15.1 +2.17.0 diff --git a/0017-llvm50-SwitchInst-case-functions-now-return-pointers.patch b/0013-llvm50-SwitchInst-case-functions-now-return-pointers.patch similarity index 92% rename from 0017-llvm50-SwitchInst-case-functions-now-return-pointers.patch rename to 0013-llvm50-SwitchInst-case-functions-now-return-pointers.patch index 6b9cfec..5aacc40 100644 --- a/0017-llvm50-SwitchInst-case-functions-now-return-pointers.patch +++ b/0013-llvm50-SwitchInst-case-functions-now-return-pointers.patch @@ -15,10 +15,10 @@ Signed-off-by: Jiri Slaby 1 file changed, 4 insertions(+) diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index 093be697c7da..5fe5bf9c1346 100644 +index 1c08870b7a20..ee6821b6dc18 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp -@@ -1571,7 +1571,11 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { +@@ -1641,7 +1641,11 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { // switch to an internal rep. llvm::IntegerType *Ty = cast(si->getCondition()->getType()); ConstantInt *ci = ConstantInt::get(Ty, CE->getZExtValue()); @@ -31,5 +31,5 @@ index 093be697c7da..5fe5bf9c1346 100644 } else { // Handle possible different branch targets -- -2.15.1 +2.17.0 diff --git a/0018-llvm50-handle-new-file_magic-s-location.patch b/0014-llvm50-handle-new-file_magic-s-location.patch similarity index 99% rename from 0018-llvm50-handle-new-file_magic-s-location.patch rename to 0014-llvm50-handle-new-file_magic-s-location.patch index f8d2b72..078e079 100644 --- a/0018-llvm50-handle-new-file_magic-s-location.patch +++ b/0014-llvm50-handle-new-file_magic-s-location.patch @@ -65,5 +65,5 @@ index ad847de0b368..5f967410568c 100644 Expected > arch = object::createBinary(Buffer, &Context); -- -2.15.1 +2.17.0 diff --git a/0019-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch b/0015-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch similarity index 90% rename from 0019-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch rename to 0015-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch index d1ad959..c06925a 100644 --- a/0019-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch +++ b/0015-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch @@ -13,10 +13,10 @@ Signed-off-by: Jiri Slaby 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index 5fe5bf9c1346..44293f885136 100644 +index ee6821b6dc18..9004b46e8f15 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp -@@ -2219,7 +2219,12 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { +@@ -2294,7 +2294,12 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { llvm::APFloat Arg(*fpWidthToSemantics(arg->getWidth()), arg->getAPValue()); uint64_t value = 0; bool isExact = true; @@ -30,7 +30,7 @@ index 5fe5bf9c1346..44293f885136 100644 llvm::APFloat::rmTowardZero, &isExact); bindLocal(ki, state, ConstantExpr::alloc(value, resultType)); break; -@@ -2236,7 +2241,12 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { +@@ -2311,7 +2316,12 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { uint64_t value = 0; bool isExact = true; @@ -45,5 +45,5 @@ index 5fe5bf9c1346..44293f885136 100644 bindLocal(ki, state, ConstantExpr::alloc(value, resultType)); break; -- -2.15.1 +2.17.0 diff --git a/0020-llvm50-AllocaInst-takes-address-space.patch b/0016-llvm50-AllocaInst-takes-address-space.patch similarity index 96% rename from 0020-llvm50-AllocaInst-takes-address-space.patch rename to 0016-llvm50-AllocaInst-takes-address-space.patch index e91e9e3..0e90c31 100644 --- a/0020-llvm50-AllocaInst-takes-address-space.patch +++ b/0016-llvm50-AllocaInst-takes-address-space.patch @@ -12,7 +12,7 @@ Signed-off-by: Jiri Slaby 1 file changed, 8 insertions(+) diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp -index 02748fbc0ee5..30100b19af3b 100644 +index ff87d210b863..c85fee861f03 100644 --- a/tools/klee/main.cpp +++ b/tools/klee/main.cpp @@ -664,10 +664,18 @@ static int initEnv(Module *mainModule) { @@ -35,5 +35,5 @@ index 02748fbc0ee5..30100b19af3b 100644 /* Insert void klee_init_env(int* argc, char*** argv) */ std::vector params; -- -2.15.1 +2.17.0 diff --git a/0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch b/0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch new file mode 100644 index 0000000..ee5862f --- /dev/null +++ b/0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch @@ -0,0 +1,52 @@ +From: Jiri Slaby +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 +--- + 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(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(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(ii->getType()); + assert(intType && "intrinsic does not have integer return type"); +-- +2.17.0 + diff --git a/0018-llvm50-test-change-objectsize.patch b/0018-llvm50-test-change-objectsize.patch new file mode 100644 index 0000000..9b82ce8 --- /dev/null +++ b/0018-llvm50-test-change-objectsize.patch @@ -0,0 +1,99 @@ +From: Jiri Slaby +Date: Wed, 23 May 2018 14:54:48 +0200 +Subject: llvm50: test, change objectsize +Patch-mainline: no + +@llvm.objectsize has now three aguments, so fix the tests accordingly. + +Signed-off-by: Jiri Slaby +--- + test/Intrinsics/objectsize.leq49.ll | 38 +++++++++++++++++++++++++++++ + test/Intrinsics/objectsize.ll | 9 ++++--- + 2 files changed, 43 insertions(+), 4 deletions(-) + create mode 100644 test/Intrinsics/objectsize.leq49.ll + +diff --git a/test/Intrinsics/objectsize.leq49.ll b/test/Intrinsics/objectsize.leq49.ll +new file mode 100644 +index 000000000000..1d184bdf292d +--- /dev/null ++++ b/test/Intrinsics/objectsize.leq49.ll +@@ -0,0 +1,38 @@ ++; Unfortunately LLVM 2.9 has a different suffix for the ``llvm.objectsize`` instrinsic ++; so this LLVM IR fails to verify for that version. ++; ++; LLVM 3.7 requires a type as the first argument to 'load' ++; REQUIRES: geq-llvm-3.7 ++; REQUIRES: lt-llvm-5.0 ++; RUN: %llvmas %s -o=%t.bc ++; RUN: rm -rf %t.klee-out ++; RUN: %klee -exit-on-error --output-dir=%t.klee-out -disable-opt %t.bc ++; ModuleID = 'objectsize.c' ++target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" ++target triple = "x86_64-unknown-linux-gnu" ++ ++define i32 @main() nounwind uwtable { ++entry: ++ %a = alloca i8*, align 8 ++ %0 = load i8*, i8** %a, align 8 ++ %1 = call i64 @llvm.objectsize.i64.p0i8(i8* %0, i1 true) ++ %cmp = icmp ne i64 %1, 0 ++ br i1 %cmp, label %abort.block, label %continue.block ++ ++continue.block: ++ %2 = load i8*, i8** %a, align 8 ++ %3 = call i64 @llvm.objectsize.i64.p0i8(i8* %2, i1 false) ++ %cmp1 = icmp ne i64 %3, -1 ++ br i1 %cmp1, label %abort.block, label %exit.block ++ ++exit.block: ++ ret i32 0 ++ ++abort.block: ++ call void @abort() ++ unreachable ++} ++ ++declare i64 @llvm.objectsize.i64.p0i8(i8*, i1) nounwind readnone ++ ++declare void @abort() noreturn nounwind +diff --git a/test/Intrinsics/objectsize.ll b/test/Intrinsics/objectsize.ll +index 3a111f99c619..95070e66e45c 100644 +--- a/test/Intrinsics/objectsize.ll ++++ b/test/Intrinsics/objectsize.ll +@@ -2,7 +2,8 @@ + ; so this LLVM IR fails to verify for that version. + ; + ; LLVM 3.7 requires a type as the first argument to 'load' +-; REQUIRES: geq-llvm-3.7 ++; LLVM 5 added nullunknown parameter to @llvm.objectsize ++; REQUIRES: geq-llvm-5.0 + ; RUN: %llvmas %s -o=%t.bc + ; RUN: rm -rf %t.klee-out + ; RUN: %klee -exit-on-error --output-dir=%t.klee-out -disable-opt %t.bc +@@ -14,13 +15,13 @@ define i32 @main() nounwind uwtable { + entry: + %a = alloca i8*, align 8 + %0 = load i8*, i8** %a, align 8 +- %1 = call i64 @llvm.objectsize.i64.p0i8(i8* %0, i1 true) ++ %1 = call i64 @llvm.objectsize.i64.p0i8(i8* %0, i1 true, i1 false) + %cmp = icmp ne i64 %1, 0 + br i1 %cmp, label %abort.block, label %continue.block + + continue.block: + %2 = load i8*, i8** %a, align 8 +- %3 = call i64 @llvm.objectsize.i64.p0i8(i8* %2, i1 false) ++ %3 = call i64 @llvm.objectsize.i64.p0i8(i8* %2, i1 false, i1 false) + %cmp1 = icmp ne i64 %3, -1 + br i1 %cmp1, label %abort.block, label %exit.block + +@@ -32,6 +33,6 @@ abort.block: + unreachable + } + +-declare i64 @llvm.objectsize.i64.p0i8(i8*, i1) nounwind readnone ++declare i64 @llvm.objectsize.i64.p0i8(i8*, i1, i1) nounwind readnone + + declare void @abort() noreturn nounwind +-- +2.17.0 + diff --git a/0019-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch b/0019-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch new file mode 100644 index 0000000..5440ffb --- /dev/null +++ b/0019-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch @@ -0,0 +1,85 @@ +From: Jiri Slaby +Date: Mon, 21 May 2018 15:12:44 +0200 +Subject: llvm60: SetVersionPrinter now passes down a stream +Patch-mainline: no + +I.e. klee::printVersion should now have a parameter -- the output +stream. Change both the prototype and the implementation to handle this +properly. + +Signed-off-by: Jiri Slaby +--- + include/klee/Internal/Support/PrintVersion.h | 8 +++++++ + lib/Support/PrintVersion.cpp | 23 ++++++++++++++------ + 2 files changed, 24 insertions(+), 7 deletions(-) + +diff --git a/include/klee/Internal/Support/PrintVersion.h b/include/klee/Internal/Support/PrintVersion.h +index 2c375ad2b946..87f73a002914 100644 +--- a/include/klee/Internal/Support/PrintVersion.h ++++ b/include/klee/Internal/Support/PrintVersion.h +@@ -10,8 +10,16 @@ + #ifndef KLEE_PRINT_VERSION_H + #define KLEE_PRINT_VERSION_H + ++#include "llvm/Support/raw_ostream.h" ++ ++#include "klee/Config/Version.h" ++ + namespace klee { ++#if LLVM_VERSION_CODE >= LLVM_VERSION(6, 0) ++ void printVersion(llvm::raw_ostream &OS); ++#else + void printVersion(); ++#endif + } + + #endif +diff --git a/lib/Support/PrintVersion.cpp b/lib/Support/PrintVersion.cpp +index d39249df023f..b7f2b6ff347a 100644 +--- a/lib/Support/PrintVersion.cpp ++++ b/lib/Support/PrintVersion.cpp +@@ -9,25 +9,34 @@ + + #include "klee/Internal/Support/PrintVersion.h" + #include "klee/Config/config.h" ++#include "klee/Config/Version.h" + #include "llvm/Support/raw_ostream.h" + #include "llvm/Support/CommandLine.h" + + #include "klee/Config/CompileTimeInfo.h" + ++#if LLVM_VERSION_CODE >= LLVM_VERSION(6, 0) ++void klee::printVersion(llvm::raw_ostream &OS) ++#else + void klee::printVersion() ++#endif + { +- llvm::outs() << PACKAGE_STRING " (" PACKAGE_URL ")\n"; ++#if LLVM_VERSION_CODE < LLVM_VERSION(6, 0) ++ llvm::raw_ostream &OS = llvm::outs(); ++#endif ++ ++ OS << PACKAGE_STRING " (" PACKAGE_URL ")\n"; + #ifdef KLEE_ENABLE_TIMESTAMP +- llvm::outs() << " Built " __DATE__ " (" __TIME__ ")\n"; ++ OS << " Built " __DATE__ " (" __TIME__ ")\n"; + #endif +- llvm::outs() << " Build mode: " << KLEE_BUILD_MODE "\n"; +- llvm::outs() << " Build revision: "; ++ OS << " Build mode: " << KLEE_BUILD_MODE "\n"; ++ OS << " Build revision: "; + #ifdef KLEE_BUILD_REVISION +- llvm::outs() << KLEE_BUILD_REVISION "\n"; ++ OS << KLEE_BUILD_REVISION "\n"; + #else +- llvm::outs() << "unknown\n"; ++ OS << "unknown\n"; + #endif + // Show LLVM version information +- llvm::outs() << "\n"; ++ OS << "\n"; + llvm::cl::PrintVersionMessage(); + } +-- +2.17.0 + diff --git a/0020-llvm60-handle-headers-renaming.patch b/0020-llvm60-handle-headers-renaming.patch new file mode 100644 index 0000000..5aefa01 --- /dev/null +++ b/0020-llvm60-handle-headers-renaming.patch @@ -0,0 +1,37 @@ +From: Jiri Slaby +Date: Mon, 21 May 2018 15:14:41 +0200 +Subject: llvm60: handle headers renaming +Patch-mainline: no + +Some headers were moved from llvm/Target/ to llvm/CodeGen/. Handle that. + +Signed-off-by: Jiri Slaby +--- + lib/Module/RaiseAsm.cpp | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/lib/Module/RaiseAsm.cpp b/lib/Module/RaiseAsm.cpp +index d9b3e40154ba..d478ff828796 100644 +--- a/lib/Module/RaiseAsm.cpp ++++ b/lib/Module/RaiseAsm.cpp +@@ -18,10 +18,16 @@ + #include "llvm/Support/raw_ostream.h" + #include "llvm/Support/Host.h" + #include "llvm/Support/TargetRegistry.h" ++#if LLVM_VERSION_CODE >= LLVM_VERSION(6, 0) ++#include "llvm/CodeGen/TargetLowering.h" ++#include "llvm/CodeGen/TargetSubtargetInfo.h" ++#include "llvm/Target/TargetMachine.h" ++#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) + #include "llvm/Target/TargetLowering.h" +-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) + #include "llvm/Target/TargetMachine.h" + #include "llvm/Target/TargetSubtargetInfo.h" ++#else ++#include "llvm/Target/TargetLowering.h" + #endif + + using namespace llvm; +-- +2.17.0 + diff --git a/_servicedata b/_servicedata index cdbeabf..bc8bd75 100644 --- a/_servicedata +++ b/_servicedata @@ -1,4 +1,4 @@ git://github.com/klee/klee.git - 37f554d5cf587ec9f6befa359a0e3aa60e9ce73f \ No newline at end of file + 843e9be8fc10c6ffb30218c5a826aab192a31955 \ No newline at end of file diff --git a/klee-1.4.0+20180108.tar.xz b/klee-1.4.0+20180108.tar.xz deleted file mode 100644 index e3bce72..0000000 --- a/klee-1.4.0+20180108.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a419c2131fb65b0d4ac8e83d88c1444adfc6cbe02916c1405f435492ff2c4bc4 -size 584980 diff --git a/klee-1.4.0+20180524.tar.xz b/klee-1.4.0+20180524.tar.xz new file mode 100644 index 0000000..1ee2ee9 --- /dev/null +++ b/klee-1.4.0+20180524.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1353ef129523802c531c8dfe87a5d81544fc2a8951877ecc830fe90f58f4a226 +size 592744 diff --git a/klee.changes b/klee.changes index 94ffaee..f6da74c 100644 --- a/klee.changes +++ b/klee.changes @@ -1,3 +1,137 @@ +------------------------------------------------------------------- +Fri May 25 10:57:57 UTC 2018 - opensuse-packaging@opensuse.org + +- Update to version 1.4.0+20180524: + * isLSB should be a boolean, as it is only used in truth contexts + * remove switch fallthrough in floating point comparision + * llvm37: enable travis testing + * llvm37: handle getRegisteredOptions + * test: add versions of some tests for LLVM 3.7 + * llvm: make KLEE compile against LLVM 3.7 + * llvm37: handle GetElementPtrInst::Create's new parameter + * test: add parenthesis around & operands +- removed patches that are in upstream now: + * 0001-llvm37-handle-GetElementPtrInst-Create-s-new-paramet.patch + * 0002-llvm-make-KLEE-compile-against-LLVM-3.7.patch + * 0003-test-add-versions-of-some-tests-for-LLVM-3.7.patch + * 0004-llvm37-handle-getRegisteredOptions.patch +- renamed patches: + * 0005-llvm-make-KLEE-compile-against-LLVM-3.8.patch + -> 0001-llvm-make-KLEE-compile-against-LLVM-3.8.patch + * 0007-llvm38-test-change-some-tests.patch + -> 0002-llvm38-test-change-some-tests.patch + * 0006-llvm-make-KLEE-compile-against-LLVM-3.9.patch + -> 0003-llvm-make-KLEE-compile-against-LLVM-3.9.patch + * 0008-llvm40-handle-different-header-names.patch + -> 0004-llvm40-handle-different-header-names.patch + * 0009-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch + -> 0005-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch + * 0010-llvm40-errorOr-and-similar.patch + -> 0006-llvm40-errorOr-and-similar.patch + * 0011-llvm-use-chrono-helpers-from-LLVM-4.0.patch + -> 0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch + * 0012-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch + -> 0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch + * 0013-llvm40-gep_type_iterator-has-no-operator.patch + -> 0009-llvm40-gep_type_iterator-has-no-operator.patch + * 0014-llvm50-avoid-on-function-arg_begin.patch + -> 0010-llvm50-avoid-on-function-arg_begin.patch + * 0015-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch + -> 0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch + * 0016-llvm50-handle-getOrInsertFunction-terminator.patch + -> 0012-llvm50-handle-getOrInsertFunction-terminator.patch + * 0017-llvm50-SwitchInst-case-functions-now-return-pointers.patch + -> 0013-llvm50-SwitchInst-case-functions-now-return-pointers.patch + * 0018-llvm50-handle-new-file_magic-s-location.patch + -> 0014-llvm50-handle-new-file_magic-s-location.patch + * 0019-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch + -> 0015-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch + * 0020-llvm50-AllocaInst-takes-address-space.patch + -> 0016-llvm50-AllocaInst-takes-address-space.patch +- added patches + * 0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch + * 0018-llvm50-test-change-objectsize.patch + * 0019-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch + * 0020-llvm60-handle-headers-renaming.patch + +------------------------------------------------------------------- +Wed May 23 12:25:13 UTC 2018 - opensuse-packaging@opensuse.org + +- Update to version 1.4.0+20180522: + * clang-format on lib/Module/{IntrinsicCleaner.cpp,Passes.h} + * some housekeeping in Passes.h and IntrinsicCleaner.cpp + * CompressionStream: fix sporadic segfaults (uninitialised avail_in) + * Removed .c_str() from getSourceLocation calls + * Renamed printFileLine to getSourceLocation (as suggested by @delcypher) to reflect the fact that it simply returns a string + * Simplified printFileLine by using std::to_string, and removed unneeded version that takes an argument a stream + * stop using DEBUG macro name + * fix some casts for LLP64 compilers + +------------------------------------------------------------------- +Mon May 21 09:30:16 UTC 2018 - opensuse-packaging@opensuse.org + +- Update to version 1.4.0+20180518: + * tests: use names in klee_make_symbolic + * Delete coverageServer.py + * Abort execution if --only-output-states-covering-new is enabled but its dependency --output-istats is not + * Add support for concretizing symbolic objects passed to external functions + * Improve error messages for ReadStringAtAddress + * Improved code quality + * Implemented incomplete merging + * remove QueryLog.h + * Update clang-format standard for KLEE codebase to C++11 + * Fix test case to check for correct call string + * Improve handling of constant array in Z3 + * Remove the option for truncating lines in assembly.ll + * Remove workaround for bug in older LLVM version (< 3) + * Fix include files + * remove unused file: tools/klee/Debug.cpp + * Fixed test case to exercise modification to utimes() + * Fixed utimes() behavior for symbolic files when the second argument is NULL + * Moved regression test to proper location. Fixes #705 + * Fix handling of errno if external functions are invoked + * Factor out method to update state memory with process state + * Ensured program reliably has 3 paths to be explored, and removed unnecessary options. Make klee_abort() call abort() in replay, and removed trivial test which cannot be easily integrated into the test suite. + * Implement klee_prefer_cex() and klee_abort() in Runtest and added corresponding tests + * add blockaddress and indirectbr instructions + * fix compilation warning + * exitOnError no output buf fix + * Change llvm apt repository to enable llvm 3.7+ + * Fix python2 linking + * doDumpStates: incorrectly increments stats + * [CMake] Add option to set GTest include dir + * fix test/Feature/BFSSearcherAndDFSSearcherInterleaved.c to use explicit enumeration of possible strings instead of CHECK-SAME (does not work as intended with LLVM >= 3.7) + * Store CexCache stats and then update klee-stats to use them + * Add missing endian information to avoid selecction of big endian systems + * Fail for aggegrations with big endian ordering + * Fixed handling of constant vectors with complex data + * Test complex constant data vectors as well + * Make print function of ObjectState public and const + * Add testcase for constant array handling + * Add test case for constant vector init + * Fix correct element order of InsertElement/ExtractElement + * Fix getelementptr for array or vector indices + * Fix generation of expressions from constant sequential data + * Added comment for getPointerWidth + * llvm50: use auto variable instead of SwitchInst::CaseIt + * Enable caching for travis-ci + * Fix coverage generation + * MergeHandler: remove unused closedStateCount + * add wllvm to the python packages to be installed + * [Travis-CI] Added codecov.io support +- Dropped patches (they are in upstream already): + * 0001-MergeHandler-remove-unused-closedStateCount.patch + * 0002-llvm50-use-auto-variable-instead-of-SwitchInst-CaseI.patch + * 0001-Fix-generation-of-expressions-from-constant-sequenti.patch + * 0002-Fix-getelementptr-for-array-or-vector-indices.patch + * 0003-Fix-correct-element-order-of-InsertElement-ExtractEl.patch + * 0004-Provide-errno-independent-of-CTYPE_EXTERNALS-being-d.patch + * 0005-Track-errno-correctly.patch + * 0006-Declare-klee_get_errno-and-remove-local-declarations.patch + * 0007-Add-support-for-modelling-errno_location.patch + * 0008-Cleanup-test-cases.patch + * 0009-test-fix-Feature-BFSSearcherAndDFSSearcherInterleave.patch + ------------------------------------------------------------------- Wed Jan 24 07:59:06 UTC 2018 - jslaby@suse.com diff --git a/klee.spec b/klee.spec index 7ec3864..4e50108 100644 --- a/klee.spec +++ b/klee.spec @@ -19,7 +19,7 @@ %define llvm_version_minor 0 %define llvm_version %{llvm_version_major} -%define version_unconverted 1.4.0+20180108 +%define version_unconverted 1.4.0+20180524 %ifarch %{ix86} x86_64 %define with_uclibc 1 @@ -31,7 +31,7 @@ Name: klee Summary: LLVM Execution Engine License: NCSA Group: Development/Languages/Other -Version: 1.4.0+20180108 +Version: 1.4.0+20180524 Release: 0 Url: http://klee.github.io/ Source0: %{name}-%{version}.tar.xz @@ -39,39 +39,26 @@ Source1: %{name}-rpmlintrc Source2: https://raw.githubusercontent.com/llvm-mirror/llvm/release_%{llvm_version_major}%{llvm_version_minor}/utils/not/not.cpp Source3: https://raw.githubusercontent.com/llvm-mirror/llvm/release_%{llvm_version_major}%{llvm_version_minor}/utils/FileCheck/FileCheck.cpp -Patch1: 0001-MergeHandler-remove-unused-closedStateCount.patch -Patch2: 0002-llvm50-use-auto-variable-instead-of-SwitchInst-CaseI.patch - -Patch101: 0001-Fix-generation-of-expressions-from-constant-sequenti.patch -Patch102: 0002-Fix-getelementptr-for-array-or-vector-indices.patch -Patch103: 0003-Fix-correct-element-order-of-InsertElement-ExtractEl.patch -Patch104: 0004-Provide-errno-independent-of-CTYPE_EXTERNALS-being-d.patch -Patch105: 0005-Track-errno-correctly.patch -Patch106: 0006-Declare-klee_get_errno-and-remove-local-declarations.patch -Patch107: 0007-Add-support-for-modelling-errno_location.patch -Patch108: 0008-Cleanup-test-cases.patch -Patch109: 0009-test-fix-Feature-BFSSearcherAndDFSSearcherInterleave.patch - -Patch201: 0001-llvm37-handle-GetElementPtrInst-Create-s-new-paramet.patch -Patch202: 0002-llvm-make-KLEE-compile-against-LLVM-3.7.patch -Patch203: 0003-test-add-versions-of-some-tests-for-LLVM-3.7.patch -Patch204: 0004-llvm37-handle-getRegisteredOptions.patch -Patch205: 0005-llvm-make-KLEE-compile-against-LLVM-3.8.patch -Patch206: 0006-llvm-make-KLEE-compile-against-LLVM-3.9.patch -Patch207: 0007-llvm38-test-change-some-tests.patch -Patch208: 0008-llvm40-handle-different-header-names.patch -Patch209: 0009-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch -Patch210: 0010-llvm40-errorOr-and-similar.patch -Patch211: 0011-llvm-use-chrono-helpers-from-LLVM-4.0.patch -Patch212: 0012-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch -Patch213: 0013-llvm40-gep_type_iterator-has-no-operator.patch -Patch214: 0014-llvm50-avoid-on-function-arg_begin.patch -Patch215: 0015-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch -Patch216: 0016-llvm50-handle-getOrInsertFunction-terminator.patch -Patch217: 0017-llvm50-SwitchInst-case-functions-now-return-pointers.patch -Patch218: 0018-llvm50-handle-new-file_magic-s-location.patch -Patch219: 0019-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch -Patch220: 0020-llvm50-AllocaInst-takes-address-space.patch +Patch201: 0001-llvm-make-KLEE-compile-against-LLVM-3.8.patch +Patch202: 0002-llvm38-test-change-some-tests.patch +Patch203: 0003-llvm-make-KLEE-compile-against-LLVM-3.9.patch +Patch204: 0004-llvm40-handle-different-header-names.patch +Patch205: 0005-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch +Patch206: 0006-llvm40-errorOr-and-similar.patch +Patch207: 0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch +Patch208: 0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch +Patch209: 0009-llvm40-gep_type_iterator-has-no-operator.patch +Patch210: 0010-llvm50-avoid-on-function-arg_begin.patch +Patch211: 0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch +Patch212: 0012-llvm50-handle-getOrInsertFunction-terminator.patch +Patch213: 0013-llvm50-SwitchInst-case-functions-now-return-pointers.patch +Patch214: 0014-llvm50-handle-new-file_magic-s-location.patch +Patch215: 0015-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch +Patch216: 0016-llvm50-AllocaInst-takes-address-space.patch +Patch217: 0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch +Patch218: 0018-llvm50-test-change-objectsize.patch +Patch219: 0019-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch +Patch220: 0020-llvm60-handle-headers-renaming.patch Patch300: klee-skip-some-tests.patch @@ -100,18 +87,6 @@ information on what KLEE is and what it can do, see the OSDI 2008 paper. %prep %setup -q -%patch1 -p1 -%patch2 -p1 - -%patch101 -p1 -%patch102 -p1 -%patch103 -p1 -%patch104 -p1 -%patch105 -p1 -%patch106 -p1 -%patch107 -p1 -%patch108 -p1 -%patch109 -p1 %patch201 -p1 %patch202 -p1 @@ -134,7 +109,7 @@ information on what KLEE is and what it can do, see the OSDI 2008 paper. %patch219 -p1 %patch220 -p1 -%patch300 -p1 +#%%patch300 -p1 mkdir -p build/test/ cp %{SOURCE2} build/test/