From e18feb65f3ef468ecb713d6c6ebb106bbe10a511ea6adcb0a5c2d79cd4e3d94a Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Sat, 16 Jun 2018 09:35:04 +0000 Subject: [PATCH 1/5] switch to LLVM 6 OBS-URL: https://build.opensuse.org/package/show/devel:tools:statica/klee?expand=0&rev=51 --- ...m-make-KLEE-compile-against-LLVM-3.8.patch | 270 --- 0001-test-remove-undefined-behaviour.patch | 71 + 0002-llvm38-no-rounding-in-APFloat.patch | 34 + ...8-handle-optimization-passes-changes.patch | 62 + ...m38-SmallString-is-always-up-to-date.patch | 33 + ...aterializeAllPermanently-was-renamed.patch | 31 + ...vm38-adapt-to-new-Linker-linkModules.patch | 72 + ...lvm38-archive-child-iterator-changes.patch | 61 + 0008-llvm38-no-more-implicit-iterators.patch | 78 + ...> 0009-llvm38-test-change-some-tests.patch | 2 +- ...m-make-KLEE-compile-against-LLVM-3.9.patch | 26 +- ...m-fix-libraries-with-llvm-config-3.9.patch | 38 + ...llvm40-handle-different-header-names.patch | 2 +- ...at-members-are-functions-in-LLVM-4.0.patch | 4 +- ...h => 0014-llvm40-errorOr-and-similar.patch | 2 +- ...lvm-use-chrono-helpers-from-LLVM-4.0.patch | 2 +- ...Type-is-not-SequentialType-in-LLVM-4.patch | 8 +- ...40-gep_type_iterator-has-no-operator.patch | 2 +- ...8-llvm50-avoid-on-function-arg_begin.patch | 2 +- ...erPartWidth-is-from-llvm-APFloatBase.patch | 2 +- ...andle-getOrInsertFunction-terminator.patch | 6 +- ...t-case-functions-now-return-pointers.patch | 4 +- ...m50-handle-new-file_magic-s-location.patch | 2 +- ...leArrayRef-for-APFloat-convertToInte.patch | 4 +- ...lvm50-AllocaInst-takes-address-space.patch | 2 +- ...insic-objectsize-has-three-arguments.patch | 6 +- ...> 0026-llvm50-test-change-objectsize.patch | 2 +- ...50-test-add-disable-O0-optnone-to-O0.patch | 1533 +++++++++++++++++ ...sionPrinter-now-passes-down-a-stream.patch | 2 +- ... 0029-llvm60-handle-headers-renaming.patch | 2 +- FileCheck.cpp | 52 +- klee-skip-some-tests.patch | 21 - klee.changes | 53 + klee.spec | 64 +- not.cpp | 3 +- 35 files changed, 2189 insertions(+), 369 deletions(-) delete mode 100644 0001-llvm-make-KLEE-compile-against-LLVM-3.8.patch create mode 100644 0001-test-remove-undefined-behaviour.patch create mode 100644 0002-llvm38-no-rounding-in-APFloat.patch create mode 100644 0003-llvm38-handle-optimization-passes-changes.patch create mode 100644 0004-llvm38-SmallString-is-always-up-to-date.patch create mode 100644 0005-llvm38-materializeAllPermanently-was-renamed.patch create mode 100644 0006-llvm38-adapt-to-new-Linker-linkModules.patch create mode 100644 0007-llvm38-archive-child-iterator-changes.patch create mode 100644 0008-llvm38-no-more-implicit-iterators.patch rename 0002-llvm38-test-change-some-tests.patch => 0009-llvm38-test-change-some-tests.patch (99%) rename 0003-llvm-make-KLEE-compile-against-LLVM-3.9.patch => 0010-llvm-make-KLEE-compile-against-LLVM-3.9.patch (94%) create mode 100644 0011-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch rename 0004-llvm40-handle-different-header-names.patch => 0012-llvm40-handle-different-header-names.patch (99%) rename 0005-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch => 0013-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch (95%) rename 0006-llvm40-errorOr-and-similar.patch => 0014-llvm40-errorOr-and-similar.patch (99%) rename 0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch => 0015-llvm-use-chrono-helpers-from-LLVM-4.0.patch (99%) rename 0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch => 0016-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch (94%) rename 0009-llvm40-gep_type_iterator-has-no-operator.patch => 0017-llvm40-gep_type_iterator-has-no-operator.patch (99%) rename 0010-llvm50-avoid-on-function-arg_begin.patch => 0018-llvm50-avoid-on-function-arg_begin.patch (99%) rename 0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch => 0019-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch (99%) rename 0012-llvm50-handle-getOrInsertFunction-terminator.patch => 0020-llvm50-handle-getOrInsertFunction-terminator.patch (98%) rename 0013-llvm50-SwitchInst-case-functions-now-return-pointers.patch => 0021-llvm50-SwitchInst-case-functions-now-return-pointers.patch (96%) rename 0014-llvm50-handle-new-file_magic-s-location.patch => 0022-llvm50-handle-new-file_magic-s-location.patch (99%) rename 0015-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch => 0023-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch (97%) rename 0016-llvm50-AllocaInst-takes-address-space.patch => 0024-llvm50-AllocaInst-takes-address-space.patch (99%) rename 0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch => 0025-llvm50-Intrinsic-objectsize-has-three-arguments.patch (94%) rename 0018-llvm50-test-change-objectsize.patch => 0026-llvm50-test-change-objectsize.patch (99%) create mode 100644 0027-llvm50-test-add-disable-O0-optnone-to-O0.patch rename 0019-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch => 0028-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch (99%) rename 0020-llvm60-handle-headers-renaming.patch => 0029-llvm60-handle-headers-renaming.patch (99%) delete mode 100644 klee-skip-some-tests.patch diff --git a/0001-llvm-make-KLEE-compile-against-LLVM-3.8.patch b/0001-llvm-make-KLEE-compile-against-LLVM-3.8.patch deleted file mode 100644 index 4d21660..0000000 --- a/0001-llvm-make-KLEE-compile-against-LLVM-3.8.patch +++ /dev/null @@ -1,270 +0,0 @@ -From: =?UTF-8?q?Richard=20Trembeck=C3=BD?= -Date: Wed, 4 May 2016 15:21:45 +0200 -Subject: llvm: make KLEE compile against LLVM 3.8 -Patch-mainline: no - -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 +++++- - 7 files changed, 77 insertions(+), 9 deletions(-) - -diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index f0781e5b882a..2c7e8d4d52a6 100644 ---- a/lib/Core/Executor.cpp -+++ b/lib/Core/Executor.cpp -@@ -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()); -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ Res.mod( -+ APFloat(*fpWidthToSemantics(right->getWidth()), right->getAPValue())); -+#else - Res.mod(APFloat(*fpWidthToSemantics(right->getWidth()),right->getAPValue()), - APFloat::rmNearestTiesToEven); -+#endif - bindLocal(ki, state, ConstantExpr::alloc(Res.bitcastToAPInt())); - break; - } -diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp -index f2a989e28439..7881f0e84be5 100644 ---- a/lib/Core/StatsTracker.cpp -+++ b/lib/Core/StatsTracker.cpp -@@ -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 { -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ res.push_back(&*(++(i->getIterator()))); -+#else - res.push_back(&*(++BasicBlock::iterator(i))); -+#endif - } - - return res; -diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp -index 3729ff82cd9d..e10e886e8915 100644 ---- a/lib/Module/IntrinsicCleaner.cpp -+++ b/lib/Module/IntrinsicCleaner.cpp -@@ -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 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 ours -+ IRBuilder<> builder(ii->getParent(), i_); -+#else - IRBuilder<> builder(ii->getParent(), ii); -- -+#endif - Value *op1 = ii->getArgOperand(0); - Value *op2 = ii->getArgOperand(1); - -diff --git a/lib/Module/LowerSwitch.cpp b/lib/Module/LowerSwitch.cpp -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, - // iterate through all the cases, creating a new BasicBlock for each - for (CaseItr it = begin; it < end; ++it) { - BasicBlock *newBlock = BasicBlock::Create(F->getContext(), "NodeBlock"); -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ Function::iterator FI = origBlock->getIterator(); -+#else - Function::iterator FI = origBlock; -+#endif - F->getBasicBlockList().insert(++FI, newBlock); - - ICmpInst *cmpInst = -@@ -101,7 +105,11 @@ void LowerSwitchPass::processSwitchInst(SwitchInst *SI) { - // if-then statements go to this and the PHI nodes are happy. - BasicBlock* newDefault = BasicBlock::Create(F->getContext(), "newDefault"); - -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ F->getBasicBlockList().insert(defaultBlock->getIterator(), newDefault); -+#else - F->getBasicBlockList().insert(defaultBlock, newDefault); -+#endif - BranchInst::Create(defaultBlock, newDefault); - - // If there is an entry in any PHI nodes for the default edge, make sure -diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp -index b07d3d2fe348..e6d592b135b6 100644 ---- a/lib/Module/ModuleUtil.cpp -+++ b/lib/Module/ModuleUtil.cpp -@@ -207,8 +207,19 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er - - StringRef memberName; - #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) -- ErrorOr memberNameErr = AI->getName(); -- std::error_code ec = memberNameErr.getError(); -+ std::error_code ec; -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ ErrorOr childErr = *AI; -+ ec = childErr.getError(); -+ if (ec) { -+ errorMessage = ec.message(); -+ return false; -+ } -+#else -+ object::Archive::child_iterator childErr = AI; -+#endif -+ ErrorOr memberNameErr = childErr->getName(); -+ ec = memberNameErr.getError(); - if (!ec) { - memberName = memberNameErr.get(); - #else -@@ -226,7 +237,8 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er - } - - #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) -- ErrorOr > child = AI->getAsBinary(); -+ ErrorOr > child = -+ childErr->getAsBinary(); - ec = child.getError(); - #else - OwningPtr child; -@@ -235,7 +247,7 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er - if (ec) { - // If we can't open as a binary object file its hopefully a bitcode file - #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) -- ErrorOr buff = AI->getMemoryBufferRef(); -+ ErrorOr buff = childErr->getMemoryBufferRef(); - ec = buff.getError(); - #elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) - ErrorOr > buffErr = AI->getMemoryBuffer(); -@@ -343,7 +355,9 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er - KLEE_DEBUG_WITH_TYPE("klee_linker", dbgs() << "Found " << GV->getName() << - " in " << M->getModuleIdentifier() << "\n"); - --#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ if (Linker::linkModules(*composite, std::unique_ptr(M))) -+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) - if (Linker::LinkModules(composite, M)) - #else - if (Linker::LinkModules(composite, M, Linker::DestroySource, &errorMessage)) -@@ -360,8 +374,10 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er - // Link succeed, now clean up - modulesLoadedOnPass++; - KLEE_DEBUG_WITH_TYPE("klee_linker", dbgs() << "Linking succeeded.\n"); -- -+// M was owned by linkModules function -+#if LLVM_VERSION_CODE < LLVM_VERSION(3, 8) - delete M; -+#endif - archiveModules[i] = 0; - - // We need to recompute the undefined symbols in the composite module -@@ -427,7 +443,9 @@ Module *klee::linkWithLibrary(Module *module, - std::string ErrorMessage; - - if (magic == sys::fs::file_magic::bitcode) { -+#if LLVM_VERSION_CODE < LLVM_VERSION(3, 8) - Module *Result = 0; -+#endif - #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) - #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) - ErrorOr > ResultErr = -@@ -445,6 +463,10 @@ Module *klee::linkWithLibrary(Module *module, - ErrorMessage.c_str()); - } - -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ if (Linker::linkModules(*module, std::move(ResultErr.get()))) { -+ ErrorMessage = "linking error"; -+#else - #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) - Result = ResultErr->release(); - #elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) -@@ -456,6 +478,7 @@ Module *klee::linkWithLibrary(Module *module, - ErrorMessage = "linking error"; - #else - if (Linker::LinkModules(module, Result, Linker::DestroySource, &ErrorMessage)) { -+#endif - #endif - klee_error("Link with library %s failed: %s", libraryName.c_str(), - ErrorMessage.c_str()); -@@ -639,7 +662,11 @@ Module *klee::loadModule(LLVMContext &ctx, const std::string &path, std::string - auto module = *errorOrModule; - #endif - -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ if (auto ec = module->materializeAll()) { -+#else - if (auto ec = module->materializeAllPermanently()) { -+#endif - errorMsg = ec.message(); - return nullptr; - } -diff --git a/lib/Module/Optimize.cpp b/lib/Module/Optimize.cpp -index 64e4863f70b3..944f51ef336d 100644 ---- a/lib/Module/Optimize.cpp -+++ b/lib/Module/Optimize.cpp -@@ -102,7 +102,12 @@ static void AddStandardCompilePasses(klee::LegacyLLVMPassManagerTy &PM) { - addPass(PM, createCFGSimplificationPass()); // Clean up after IPCP & DAE - - addPass(PM, createPruneEHPass()); // Remove dead EH info -- addPass(PM, createFunctionAttrsPass()); // Deduce function attrs -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ addPass(PM, createPostOrderFunctionAttrsPass()); -+ addPass(PM, createReversePostOrderFunctionAttrsPass()); -+#else -+ addPass(PM, createFunctionAttrsPass()); // Deduce function attrs -+#endif - - if (!DisableInline) - addPass(PM, createFunctionInliningPass()); // Inline small functions -@@ -217,8 +222,14 @@ void Optimize(Module *M, const std::string &EntryPoint) { - addPass(Passes, createScalarReplAggregatesPass()); // Break up allocas - - // Run a few AA driven optimizations here and now, to cleanup the code. -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ addPass(Passes, createPostOrderFunctionAttrsPass()); -+ addPass(Passes, createReversePostOrderFunctionAttrsPass()); -+ // addPass(Passes, createGlobalsAAWrapperPass()); -+#else - addPass(Passes, createFunctionAttrsPass()); // Add nocapture - addPass(Passes, createGlobalsModRefPass()); // IP alias analysis -+#endif - - addPass(Passes, createLICMPass()); // Hoist loop invariants - addPass(Passes, createGVNPass()); // Remove redundancies -diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp -index ab9dfe286ffb..3d73ae07fcb5 100644 ---- a/tools/klee/main.cpp -+++ b/tools/klee/main.cpp -@@ -291,7 +291,12 @@ KleeHandler::KleeHandler(int argc, char **argv) - for (; i <= INT_MAX; ++i) { - SmallString<128> d(directory); - llvm::sys::path::append(d, "klee-out-"); -- raw_svector_ostream ds(d); ds << i; ds.flush(); -+ raw_svector_ostream ds(d); -+ ds << i; -+// SmallString is always up-to-date, no need to flush. See Support/raw_ostream.h -+#if LLVM_VERSION_CODE < LLVM_VERSION(3, 8) -+ ds.flush(); -+#endif - - // create directory and try to link klee-last - if (mkdir(d.c_str(), 0775) == 0) { --- -2.17.0 - diff --git a/0001-test-remove-undefined-behaviour.patch b/0001-test-remove-undefined-behaviour.patch new file mode 100644 index 0000000..a9287f0 --- /dev/null +++ b/0001-test-remove-undefined-behaviour.patch @@ -0,0 +1,71 @@ +From: Jiri Slaby +Date: Fri, 15 Jun 2018 10:32:26 +0200 +Subject: test: remove undefined behaviour +Patch-mainline: no + +Shifting negative values is implementation-defined. + +Shifting by equal number of the bits as is the size of the type is +undefined. + +So fix both of these. + +This fixes #911. + +Signed-off-by: Jiri Slaby +--- + .../Feature/arithmetic-right-overshift-sym-conc.c | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/test/Feature/arithmetic-right-overshift-sym-conc.c b/test/Feature/arithmetic-right-overshift-sym-conc.c +index 7af6f9d7f08f..63b93db32ed9 100644 +--- a/test/Feature/arithmetic-right-overshift-sym-conc.c ++++ b/test/Feature/arithmetic-right-overshift-sym-conc.c +@@ -13,14 +13,17 @@ typedef enum + UNKNOWN + } overshift_t; + ++#define INT_31_BITS (0xffffffff >> 1) ++ + // We're using signed ints so should be doing + // arithmetic right shift. + // lhs should be a constant +-int overshift(signed int lhs, volatile unsigned int y, const char * type) ++unsigned int overshift(unsigned int lhs, volatile unsigned int y, ++ const char *type) + { + overshift_t ret; +- volatile signed int x = lhs; +- unsigned int limit = sizeof(x)*8; ++ volatile unsigned int x = lhs; ++ unsigned int limit = sizeof(x)*8 - 1; + assert(!klee_is_symbolic(x)); + + volatile signed int result; +@@ -47,12 +50,12 @@ int overshift(signed int lhs, volatile unsigned int y, const char * type) + + int main(int argc, char** argv) + { +- volatile unsigned int y = sizeof(unsigned int)*8; ++ volatile unsigned int y = sizeof(unsigned int)*8 - 1; + // Try with +ve lhs + overshift_t conc = overshift(15, y, "Concrete"); + assert(conc == TO_ZERO); + // Try with -ve lhs +- conc = overshift(-1, y, "Concrete"); ++ conc = overshift(INT_31_BITS, y, "Concrete"); + assert(conc == TO_ZERO); + + // Symbolic overshift +@@ -65,7 +68,7 @@ int main(int argc, char** argv) + overshift_t sym = overshift(15, y2, "Symbolic"); + assert(sym == TO_ZERO); + // Try with -ve lhs +- sym = overshift(-1, y2, "Symbolic"); ++ sym = overshift(INT_31_BITS, y2, "Symbolic"); + assert(sym == TO_ZERO); + + // Concrete and symbolic behaviour should be the same +-- +2.17.1 + diff --git a/0002-llvm38-no-rounding-in-APFloat.patch b/0002-llvm38-no-rounding-in-APFloat.patch new file mode 100644 index 0000000..cd135be --- /dev/null +++ b/0002-llvm38-no-rounding-in-APFloat.patch @@ -0,0 +1,34 @@ +From: Jiri Slaby +Date: Fri, 15 Jun 2018 07:51:10 +0200 +Subject: llvm38: no rounding in APFloat +Patch-mainline: no + +The rounding was removed because it was never needed: +llvm-mirror/llvm@ff278be + +Signed-off-by: Jiri Slaby +--- + lib/Core/Executor.cpp | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp +index 24fcea8811c4..b846947e5455 100644 +--- a/lib/Core/Executor.cpp ++++ b/lib/Core/Executor.cpp +@@ -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()); ++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) ++ Res.mod( ++ APFloat(*fpWidthToSemantics(right->getWidth()), right->getAPValue())); ++#else + Res.mod(APFloat(*fpWidthToSemantics(right->getWidth()),right->getAPValue()), + APFloat::rmNearestTiesToEven); ++#endif + bindLocal(ki, state, ConstantExpr::alloc(Res.bitcastToAPInt())); + break; + } +-- +2.17.1 + diff --git a/0003-llvm38-handle-optimization-passes-changes.patch b/0003-llvm38-handle-optimization-passes-changes.patch new file mode 100644 index 0000000..ffd2b0f --- /dev/null +++ b/0003-llvm38-handle-optimization-passes-changes.patch @@ -0,0 +1,62 @@ +From: Jiri Slaby +Date: Fri, 15 Jun 2018 07:57:23 +0200 +Subject: llvm38: handle optimization passes changes +Patch-mainline: no + +createFunctionAttrsPass was split to createPostOrderFunctionAttrsPass +and createReversePostOrderFunctionAttrsPass in LLVM commit e96fb9ab15d4. + +createGlobalsModRefPass was changed to createGlobalsAAWrapperPass in +LLVM commit 9146833fa313. + +Signed-off-by: Jiri Slaby +--- + lib/Module/Optimize.cpp | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/lib/Module/Optimize.cpp b/lib/Module/Optimize.cpp +index 64e4863f70b3..df7b147d0abe 100644 +--- a/lib/Module/Optimize.cpp ++++ b/lib/Module/Optimize.cpp +@@ -35,6 +35,10 @@ + #include "llvm/Analysis/Verifier.h" + #endif + ++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) ++#include "llvm/Analysis/GlobalsModRef.h" ++#endif ++ + using namespace llvm; + + // Don't verify at the end +@@ -102,7 +106,12 @@ static void AddStandardCompilePasses(klee::LegacyLLVMPassManagerTy &PM) { + addPass(PM, createCFGSimplificationPass()); // Clean up after IPCP & DAE + + addPass(PM, createPruneEHPass()); // Remove dead EH info ++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) ++ addPass(PM, createPostOrderFunctionAttrsPass()); ++ addPass(PM, createReversePostOrderFunctionAttrsPass()); // Deduce function attrs ++#else + addPass(PM, createFunctionAttrsPass()); // Deduce function attrs ++#endif + + if (!DisableInline) + addPass(PM, createFunctionInliningPass()); // Inline small functions +@@ -217,8 +226,14 @@ void Optimize(Module *M, const std::string &EntryPoint) { + addPass(Passes, createScalarReplAggregatesPass()); // Break up allocas + + // Run a few AA driven optimizations here and now, to cleanup the code. ++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) ++ addPass(Passes, createPostOrderFunctionAttrsPass()); ++ addPass(Passes, createReversePostOrderFunctionAttrsPass()); // Add nocapture ++ addPass(Passes, createGlobalsAAWrapperPass()); // IP alias analysis ++#else + addPass(Passes, createFunctionAttrsPass()); // Add nocapture + addPass(Passes, createGlobalsModRefPass()); // IP alias analysis ++#endif + + addPass(Passes, createLICMPass()); // Hoist loop invariants + addPass(Passes, createGVNPass()); // Remove redundancies +-- +2.17.1 + diff --git a/0004-llvm38-SmallString-is-always-up-to-date.patch b/0004-llvm38-SmallString-is-always-up-to-date.patch new file mode 100644 index 0000000..e2a506e --- /dev/null +++ b/0004-llvm38-SmallString-is-always-up-to-date.patch @@ -0,0 +1,33 @@ +From: Jiri Slaby +Date: Fri, 15 Jun 2018 08:14:39 +0200 +Subject: llvm38: SmallString is always up-to-date +Patch-mainline: no + +No need to flush it, see llvm-mirror/llvm@d4177b2 + +Signed-off-by: Jiri Slaby +--- + tools/klee/main.cpp | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp +index ab9dfe286ffb..3d73ae07fcb5 100644 +--- a/tools/klee/main.cpp ++++ b/tools/klee/main.cpp +@@ -291,7 +291,12 @@ KleeHandler::KleeHandler(int argc, char **argv) + for (; i <= INT_MAX; ++i) { + SmallString<128> d(directory); + llvm::sys::path::append(d, "klee-out-"); +- raw_svector_ostream ds(d); ds << i; ds.flush(); ++ raw_svector_ostream ds(d); ++ ds << i; ++// SmallString is always up-to-date, no need to flush. See Support/raw_ostream.h ++#if LLVM_VERSION_CODE < LLVM_VERSION(3, 8) ++ ds.flush(); ++#endif + + // create directory and try to link klee-last + if (mkdir(d.c_str(), 0775) == 0) { +-- +2.17.1 + diff --git a/0005-llvm38-materializeAllPermanently-was-renamed.patch b/0005-llvm38-materializeAllPermanently-was-renamed.patch new file mode 100644 index 0000000..82c4653 --- /dev/null +++ b/0005-llvm38-materializeAllPermanently-was-renamed.patch @@ -0,0 +1,31 @@ +From: Jiri Slaby +Date: Fri, 15 Jun 2018 08:19:39 +0200 +Subject: llvm38: materializeAllPermanently was renamed +Patch-mainline: no + +To materializeAll. Happened in LLVM commit 838f8a4b1db2. + +Signed-off-by: Jiri Slaby +--- + lib/Module/ModuleUtil.cpp | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp +index b07d3d2fe348..ce52819d2579 100644 +--- a/lib/Module/ModuleUtil.cpp ++++ b/lib/Module/ModuleUtil.cpp +@@ -639,7 +639,11 @@ Module *klee::loadModule(LLVMContext &ctx, const std::string &path, std::string + auto module = *errorOrModule; + #endif + ++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) ++ if (auto ec = module->materializeAll()) { ++#else + if (auto ec = module->materializeAllPermanently()) { ++#endif + errorMsg = ec.message(); + return nullptr; + } +-- +2.17.1 + diff --git a/0006-llvm38-adapt-to-new-Linker-linkModules.patch b/0006-llvm38-adapt-to-new-Linker-linkModules.patch new file mode 100644 index 0000000..5967cce --- /dev/null +++ b/0006-llvm38-adapt-to-new-Linker-linkModules.patch @@ -0,0 +1,72 @@ +From: Jiri Slaby +Date: Fri, 15 Jun 2018 08:21:39 +0200 +Subject: llvm38: adapt to new Linker::linkModules +Patch-mainline: no + +LLVM commit d912be98f8eb changed the prototype of linkModules to accept +std::unique_ptr. Adapt to that. + +Signed-off-by: Jiri Slaby +--- + lib/Module/ModuleUtil.cpp | 15 +++++++++++++-- + 1 file changed, 13 insertions(+), 2 deletions(-) + +diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp +index ce52819d2579..025b7374fcf9 100644 +--- a/lib/Module/ModuleUtil.cpp ++++ b/lib/Module/ModuleUtil.cpp +@@ -343,7 +343,9 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er + KLEE_DEBUG_WITH_TYPE("klee_linker", dbgs() << "Found " << GV->getName() << + " in " << M->getModuleIdentifier() << "\n"); + +-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) ++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) ++ if (Linker::linkModules(*composite, std::unique_ptr(M))) ++#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) + if (Linker::LinkModules(composite, M)) + #else + if (Linker::LinkModules(composite, M, Linker::DestroySource, &errorMessage)) +@@ -360,8 +362,10 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er + // Link succeed, now clean up + modulesLoadedOnPass++; + KLEE_DEBUG_WITH_TYPE("klee_linker", dbgs() << "Linking succeeded.\n"); +- ++// M was owned by linkModules function ++#if LLVM_VERSION_CODE < LLVM_VERSION(3, 8) + delete M; ++#endif + archiveModules[i] = 0; + + // We need to recompute the undefined symbols in the composite module +@@ -427,7 +431,9 @@ Module *klee::linkWithLibrary(Module *module, + std::string ErrorMessage; + + if (magic == sys::fs::file_magic::bitcode) { ++#if LLVM_VERSION_CODE < LLVM_VERSION(3, 8) + Module *Result = 0; ++#endif + #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) + #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) + ErrorOr > ResultErr = +@@ -445,6 +451,10 @@ Module *klee::linkWithLibrary(Module *module, + ErrorMessage.c_str()); + } + ++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) ++ if (Linker::linkModules(*module, std::move(ResultErr.get()))) { ++ ErrorMessage = "linking error"; ++#else + #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) + Result = ResultErr->release(); + #elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) +@@ -456,6 +466,7 @@ Module *klee::linkWithLibrary(Module *module, + ErrorMessage = "linking error"; + #else + if (Linker::LinkModules(module, Result, Linker::DestroySource, &ErrorMessage)) { ++#endif + #endif + klee_error("Link with library %s failed: %s", libraryName.c_str(), + ErrorMessage.c_str()); +-- +2.17.1 + diff --git a/0007-llvm38-archive-child-iterator-changes.patch b/0007-llvm38-archive-child-iterator-changes.patch new file mode 100644 index 0000000..269877e --- /dev/null +++ b/0007-llvm38-archive-child-iterator-changes.patch @@ -0,0 +1,61 @@ +From: Jiri Slaby +Date: Fri, 15 Jun 2018 08:28:22 +0200 +Subject: llvm38: archive child iterator changes +Patch-mainline: no + +After LLVM commit 25569fdcdab0, archive iterator returns +object::Archive::Child instead of child_iterator, adapt to that. + +Signed-off-by: Jiri Slaby +--- + lib/Module/ModuleUtil.cpp | 20 ++++++++++++++++---- + 1 file changed, 16 insertions(+), 4 deletions(-) + +diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp +index 025b7374fcf9..e6d592b135b6 100644 +--- a/lib/Module/ModuleUtil.cpp ++++ b/lib/Module/ModuleUtil.cpp +@@ -207,8 +207,19 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er + + StringRef memberName; + #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) +- ErrorOr memberNameErr = AI->getName(); +- std::error_code ec = memberNameErr.getError(); ++ std::error_code ec; ++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) ++ ErrorOr childErr = *AI; ++ ec = childErr.getError(); ++ if (ec) { ++ errorMessage = ec.message(); ++ return false; ++ } ++#else ++ object::Archive::child_iterator childErr = AI; ++#endif ++ ErrorOr memberNameErr = childErr->getName(); ++ ec = memberNameErr.getError(); + if (!ec) { + memberName = memberNameErr.get(); + #else +@@ -226,7 +237,8 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er + } + + #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) +- ErrorOr > child = AI->getAsBinary(); ++ ErrorOr > child = ++ childErr->getAsBinary(); + ec = child.getError(); + #else + OwningPtr child; +@@ -235,7 +247,7 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er + if (ec) { + // If we can't open as a binary object file its hopefully a bitcode file + #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) +- ErrorOr buff = AI->getMemoryBufferRef(); ++ ErrorOr buff = childErr->getMemoryBufferRef(); + ec = buff.getError(); + #elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) + ErrorOr > buffErr = AI->getMemoryBuffer(); +-- +2.17.1 + diff --git a/0008-llvm38-no-more-implicit-iterators.patch b/0008-llvm38-no-more-implicit-iterators.patch new file mode 100644 index 0000000..965a9a7 --- /dev/null +++ b/0008-llvm38-no-more-implicit-iterators.patch @@ -0,0 +1,78 @@ +From: =?UTF-8?q?Richard=20Trembeck=C3=BD?= +Date: Wed, 4 May 2016 15:21:45 +0200 +Subject: llvm38: no more implicit iterators +Patch-mainline: no + +LLVM commit eac309550f25 removed implicit iterator conversions. So we +have to get the iterators explicitly now. + +Signed-off-by: Jiri Slaby +--- + lib/Core/StatsTracker.cpp | 4 ++++ + lib/Module/IntrinsicCleaner.cpp | 4 ++++ + lib/Module/LowerSwitch.cpp | 8 ++++++++ + 3 files changed, 16 insertions(+) + +diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp +index f2a989e28439..7881f0e84be5 100644 +--- a/lib/Core/StatsTracker.cpp ++++ b/lib/Core/StatsTracker.cpp +@@ -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 { ++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) ++ res.push_back(&*(++(i->getIterator()))); ++#else + res.push_back(&*(++BasicBlock::iterator(i))); ++#endif + } + + return res; +diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp +index 3729ff82cd9d..0f7eb223a2d3 100644 +--- a/lib/Module/IntrinsicCleaner.cpp ++++ b/lib/Module/IntrinsicCleaner.cpp +@@ -110,7 +110,11 @@ 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) ++ IRBuilder<> builder(ii->getParent(), ii->getIterator()); ++#else + IRBuilder<> builder(ii->getParent(), ii); ++#endif + + Value *op1 = ii->getArgOperand(0); + Value *op2 = ii->getArgOperand(1); +diff --git a/lib/Module/LowerSwitch.cpp b/lib/Module/LowerSwitch.cpp +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, + // iterate through all the cases, creating a new BasicBlock for each + for (CaseItr it = begin; it < end; ++it) { + BasicBlock *newBlock = BasicBlock::Create(F->getContext(), "NodeBlock"); ++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) ++ Function::iterator FI = origBlock->getIterator(); ++#else + Function::iterator FI = origBlock; ++#endif + F->getBasicBlockList().insert(++FI, newBlock); + + ICmpInst *cmpInst = +@@ -101,7 +105,11 @@ void LowerSwitchPass::processSwitchInst(SwitchInst *SI) { + // if-then statements go to this and the PHI nodes are happy. + BasicBlock* newDefault = BasicBlock::Create(F->getContext(), "newDefault"); + ++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) ++ F->getBasicBlockList().insert(defaultBlock->getIterator(), newDefault); ++#else + F->getBasicBlockList().insert(defaultBlock, newDefault); ++#endif + BranchInst::Create(defaultBlock, newDefault); + + // If there is an entry in any PHI nodes for the default edge, make sure +-- +2.17.1 + diff --git a/0002-llvm38-test-change-some-tests.patch b/0009-llvm38-test-change-some-tests.patch similarity index 99% rename from 0002-llvm38-test-change-some-tests.patch rename to 0009-llvm38-test-change-some-tests.patch index c1b8437..2db27ca 100644 --- a/0002-llvm38-test-change-some-tests.patch +++ b/0009-llvm38-test-change-some-tests.patch @@ -151,5 +151,5 @@ index 7eddd3d6a01c..7ef74a8da43c 100644 define i32 @__foo(i32 %i) nounwind { entry: -- -2.17.0 +2.17.1 diff --git a/0003-llvm-make-KLEE-compile-against-LLVM-3.9.patch b/0010-llvm-make-KLEE-compile-against-LLVM-3.9.patch similarity index 94% rename from 0003-llvm-make-KLEE-compile-against-LLVM-3.9.patch rename to 0010-llvm-make-KLEE-compile-against-LLVM-3.9.patch index 0c7a1c4..f3db496 100644 --- a/0003-llvm-make-KLEE-compile-against-LLVM-3.9.patch +++ b/0010-llvm-make-KLEE-compile-against-LLVM-3.9.patch @@ -15,7 +15,7 @@ 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 2c7e8d4d52a6..b2178cccefd2 100644 +index b846947e5455..385920627641 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp @@ -1305,10 +1305,18 @@ void Executor::executeCall(ExecutionState &state, @@ -151,11 +151,11 @@ index e6d592b135b6..ee4af254dae2 100644 } else { v = NULL; diff --git a/lib/Module/Optimize.cpp b/lib/Module/Optimize.cpp -index 944f51ef336d..ae1d4839f772 100644 +index df7b147d0abe..8239c3a24c12 100644 --- a/lib/Module/Optimize.cpp +++ b/lib/Module/Optimize.cpp -@@ -35,6 +35,11 @@ - #include "llvm/Analysis/Verifier.h" +@@ -39,6 +39,11 @@ + #include "llvm/Analysis/GlobalsModRef.h" #endif +#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) @@ -166,7 +166,7 @@ index 944f51ef336d..ae1d4839f772 100644 using namespace llvm; // Don't verify at the end -@@ -103,7 +108,11 @@ static void AddStandardCompilePasses(klee::LegacyLLVMPassManagerTy &PM) { +@@ -107,7 +112,11 @@ static void AddStandardCompilePasses(klee::LegacyLLVMPassManagerTy &PM) { addPass(PM, createPruneEHPass()); // Remove dead EH info #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) @@ -175,10 +175,10 @@ index 944f51ef336d..ae1d4839f772 100644 +#else addPass(PM, createPostOrderFunctionAttrsPass()); +#endif - addPass(PM, createReversePostOrderFunctionAttrsPass()); + addPass(PM, createReversePostOrderFunctionAttrsPass()); // Deduce function attrs #else - addPass(PM, createFunctionAttrsPass()); // Deduce function attrs -@@ -116,7 +125,11 @@ static void AddStandardCompilePasses(klee::LegacyLLVMPassManagerTy &PM) { + addPass(PM, createFunctionAttrsPass()); // Deduce function attrs +@@ -120,7 +129,11 @@ static void AddStandardCompilePasses(klee::LegacyLLVMPassManagerTy &PM) { addPass(PM, createInstructionCombiningPass()); // Cleanup for scalarrepl. addPass(PM, createJumpThreadingPass()); // Thread jumps. addPass(PM, createCFGSimplificationPass()); // Merge & remove BBs @@ -190,7 +190,7 @@ index 944f51ef336d..ae1d4839f772 100644 addPass(PM, createInstructionCombiningPass()); // Combine silly seq's addPass(PM, createTailCallEliminationPass()); // Eliminate tail calls -@@ -179,8 +192,15 @@ void Optimize(Module *M, const std::string &EntryPoint) { +@@ -183,8 +196,15 @@ void Optimize(Module *M, const std::string &EntryPoint) { // for a main function. If main is defined, mark all other functions // internal. if (!DisableInternalize) { @@ -206,7 +206,7 @@ index 944f51ef336d..ae1d4839f772 100644 addPass(Passes, pass); } -@@ -219,11 +239,19 @@ void Optimize(Module *M, const std::string &EntryPoint) { +@@ -223,11 +243,19 @@ void Optimize(Module *M, const std::string &EntryPoint) { // The IPO passes may leave cruft around. Clean up after them. addPass(Passes, createInstructionCombiningPass()); addPass(Passes, createJumpThreadingPass()); // Thread jumps. @@ -223,8 +223,8 @@ index 944f51ef336d..ae1d4839f772 100644 +#else addPass(Passes, createPostOrderFunctionAttrsPass()); +#endif - addPass(Passes, createReversePostOrderFunctionAttrsPass()); - // addPass(Passes, createGlobalsAAWrapperPass()); + addPass(Passes, createReversePostOrderFunctionAttrsPass()); // Add nocapture + addPass(Passes, createGlobalsAAWrapperPass()); // IP alias analysis #else diff --git a/lib/Module/RaiseAsm.cpp b/lib/Module/RaiseAsm.cpp index c597fa2a7b82..d9b3e40154ba 100644 @@ -288,5 +288,5 @@ index 3d73ae07fcb5..c0ea4fa54551 100644 if (Watchdog) { if (MaxTime==0) { -- -2.17.0 +2.17.1 diff --git a/0011-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch b/0011-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch new file mode 100644 index 0000000..86d8f6e --- /dev/null +++ b/0011-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch @@ -0,0 +1,38 @@ +From: Jiri Slaby +Date: Fri, 25 May 2018 15:17:03 +0200 +Subject: cmake: find_llvm, fix libraries with llvm-config 3.9 +Patch-mainline: no + +llvm-config from llvm 3.9 was broken. Fix handling of improperly +returned libraries. +From: +liblibLLVM-3.9.so.so +To: +libLLVM-3.9.so + +Fixes #895. + +Signed-off-by: Jiri Slaby +--- + cmake/find_llvm.cmake | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/cmake/find_llvm.cmake b/cmake/find_llvm.cmake +index adf68c4fc82a..8ceed19f7b9e 100644 +--- a/cmake/find_llvm.cmake ++++ b/cmake/find_llvm.cmake +@@ -172,7 +172,11 @@ else() + set(targets_to_return "") + set(created_targets "") + foreach (llvm_lib ${_llvm_libs_list}) ++ # a bug in llvm-config from LLVM 3.9 ++ string(REGEX REPLACE "lib(libLLVM[-.a-zA-Z0-9]+\\.so)\\.so$" "\\1" llvm_lib "${llvm_lib}") ++ + get_filename_component(llvm_lib_file_name "${llvm_lib}" NAME) ++ + string(REGEX REPLACE "^(lib)?(LLVM[-.a-zA-Z0-9]+)\\..+$" "\\2" target_name "${llvm_lib_file_name}") + list(APPEND targets_to_return "${target_name}") + if (NOT TARGET "${target_name}") +-- +2.17.1 + diff --git a/0004-llvm40-handle-different-header-names.patch b/0012-llvm40-handle-different-header-names.patch similarity index 99% rename from 0004-llvm40-handle-different-header-names.patch rename to 0012-llvm40-handle-different-header-names.patch index 1008dc1..9e73e5b 100644 --- a/0004-llvm40-handle-different-header-names.patch +++ b/0012-llvm40-handle-different-header-names.patch @@ -84,5 +84,5 @@ index c0ea4fa54551..154a76feb361 100644 #include #include -- -2.17.0 +2.17.1 diff --git a/0005-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch b/0013-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch similarity index 95% rename from 0005-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch rename to 0013-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch index ef44937..b5277fb 100644 --- a/0005-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch +++ b/0013-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch @@ -9,7 +9,7 @@ Signed-off-by: Jiri Slaby 1 file changed, 9 insertions(+) diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index b2178cccefd2..75132e0db71b 100644 +index 385920627641..61a54d72f48b 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp @@ -1448,12 +1448,21 @@ static bool isDebugIntrinsic(const Function *f, KModule *KM) { @@ -35,5 +35,5 @@ index b2178cccefd2..75132e0db71b 100644 return 0; } -- -2.17.0 +2.17.1 diff --git a/0006-llvm40-errorOr-and-similar.patch b/0014-llvm40-errorOr-and-similar.patch similarity index 99% rename from 0006-llvm40-errorOr-and-similar.patch rename to 0014-llvm40-errorOr-and-similar.patch index a9f89db..776e435 100644 --- a/0006-llvm40-errorOr-and-similar.patch +++ b/0014-llvm40-errorOr-and-similar.patch @@ -124,5 +124,5 @@ index 8aa070743048..ad847de0b368 100644 #else if (auto ec = module->materializeAllPermanently()) { -- -2.17.0 +2.17.1 diff --git a/0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch b/0015-llvm-use-chrono-helpers-from-LLVM-4.0.patch similarity index 99% rename from 0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch rename to 0015-llvm-use-chrono-helpers-from-LLVM-4.0.patch index c2c4859..da58b96 100644 --- a/0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch +++ b/0015-llvm-use-chrono-helpers-from-LLVM-4.0.patch @@ -195,5 +195,5 @@ index da96981079ae..a223b39ada57 100644 + +#endif -- -2.17.0 +2.17.1 diff --git a/0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch b/0016-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch similarity index 94% rename from 0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch rename to 0016-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch index bded69b..8f01086 100644 --- a/0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch +++ b/0016-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch @@ -27,10 +27,10 @@ index 5fb9f4ec5c2f..bf7cb6ff0bea 100644 CurTy = 0; } diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index 75132e0db71b..1c08870b7a20 100644 +index 61a54d72f48b..f994a82e2df7 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp -@@ -2598,8 +2598,7 @@ void Executor::computeOffsets(KGEPInstruction *kgepi, TypeIt ib, TypeIt ie) { +@@ -2589,8 +2589,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 75132e0db71b..1c08870b7a20 100644 uint64_t elementSize = kmodule->targetData->getTypeStoreSize(set->getElementType()); Value *operand = ii.getOperand(); -@@ -2613,7 +2612,24 @@ void Executor::computeOffsets(KGEPInstruction *kgepi, TypeIt ib, TypeIt ie) { +@@ -2604,7 +2603,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 75132e0db71b..1c08870b7a20 100644 } kgepi->offset = constantOffset->getZExtValue(); -- -2.17.0 +2.17.1 diff --git a/0009-llvm40-gep_type_iterator-has-no-operator.patch b/0017-llvm40-gep_type_iterator-has-no-operator.patch similarity index 99% rename from 0009-llvm40-gep_type_iterator-has-no-operator.patch rename to 0017-llvm40-gep_type_iterator-has-no-operator.patch index 078880f..e78279c 100644 --- a/0009-llvm40-gep_type_iterator-has-no-operator.patch +++ b/0017-llvm40-gep_type_iterator-has-no-operator.patch @@ -28,5 +28,5 @@ index a352db3339c4..7718ae9d0ccb 100644 const StructLayout *SL = kmodule->targetData->getStructLayout(STy); base = base->Add( -- -2.17.0 +2.17.1 diff --git a/0010-llvm50-avoid-on-function-arg_begin.patch b/0018-llvm50-avoid-on-function-arg_begin.patch similarity index 99% rename from 0010-llvm50-avoid-on-function-arg_begin.patch rename to 0018-llvm50-avoid-on-function-arg_begin.patch index 89e5783..ba6053a 100644 --- a/0010-llvm50-avoid-on-function-arg_begin.patch +++ b/0018-llvm50-avoid-on-function-arg_begin.patch @@ -46,5 +46,5 @@ index 154a76feb361..def83b584167 100644 args.push_back(Constant::getNullValue(ft->getParamType(4))); // app_fini args.push_back(Constant::getNullValue(ft->getParamType(5))); // rtld_fini -- -2.17.0 +2.17.1 diff --git a/0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch b/0019-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch similarity index 99% rename from 0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch rename to 0019-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch index 3584369..3be6409 100644 --- a/0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch +++ b/0019-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch @@ -28,5 +28,5 @@ index f73d1614c250..5433d9211ead 100644 } } -- -2.17.0 +2.17.1 diff --git a/0012-llvm50-handle-getOrInsertFunction-terminator.patch b/0020-llvm50-handle-getOrInsertFunction-terminator.patch similarity index 98% rename from 0012-llvm50-handle-getOrInsertFunction-terminator.patch rename to 0020-llvm50-handle-getOrInsertFunction-terminator.patch index bf02382..f209c3d 100644 --- a/0012-llvm50-handle-getOrInsertFunction-terminator.patch +++ b/0020-llvm50-handle-getOrInsertFunction-terminator.patch @@ -58,10 +58,10 @@ index aac63e1d9854..406b3045e527 100644 } diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp -index e10e886e8915..d4f93bdc591e 100644 +index 0f7eb223a2d3..4d323b8e8344 100644 --- a/lib/Module/IntrinsicCleaner.cpp +++ b/lib/Module/IntrinsicCleaner.cpp -@@ -214,7 +214,8 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) { +@@ -210,7 +210,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( @@ -116,5 +116,5 @@ index def83b584167..ff87d210b863 100644 f = mainModule->getFunction("__ctype_get_mb_cur_max"); -- -2.17.0 +2.17.1 diff --git a/0013-llvm50-SwitchInst-case-functions-now-return-pointers.patch b/0021-llvm50-SwitchInst-case-functions-now-return-pointers.patch similarity index 96% rename from 0013-llvm50-SwitchInst-case-functions-now-return-pointers.patch rename to 0021-llvm50-SwitchInst-case-functions-now-return-pointers.patch index 5aacc40..cfed880 100644 --- a/0013-llvm50-SwitchInst-case-functions-now-return-pointers.patch +++ b/0021-llvm50-SwitchInst-case-functions-now-return-pointers.patch @@ -15,7 +15,7 @@ Signed-off-by: Jiri Slaby 1 file changed, 4 insertions(+) diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index 1c08870b7a20..ee6821b6dc18 100644 +index f994a82e2df7..bca2eb6e06a7 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp @@ -1641,7 +1641,11 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { @@ -31,5 +31,5 @@ index 1c08870b7a20..ee6821b6dc18 100644 } else { // Handle possible different branch targets -- -2.17.0 +2.17.1 diff --git a/0014-llvm50-handle-new-file_magic-s-location.patch b/0022-llvm50-handle-new-file_magic-s-location.patch similarity index 99% rename from 0014-llvm50-handle-new-file_magic-s-location.patch rename to 0022-llvm50-handle-new-file_magic-s-location.patch index 078e079..c1b8857 100644 --- a/0014-llvm50-handle-new-file_magic-s-location.patch +++ b/0022-llvm50-handle-new-file_magic-s-location.patch @@ -65,5 +65,5 @@ index ad847de0b368..5f967410568c 100644 Expected > arch = object::createBinary(Buffer, &Context); -- -2.17.0 +2.17.1 diff --git a/0015-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch b/0023-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch similarity index 97% rename from 0015-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch rename to 0023-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch index c06925a..f0406dd 100644 --- a/0015-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch +++ b/0023-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch @@ -13,7 +13,7 @@ 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 ee6821b6dc18..9004b46e8f15 100644 +index bca2eb6e06a7..70337c000cd2 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp @@ -2294,7 +2294,12 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { @@ -45,5 +45,5 @@ index ee6821b6dc18..9004b46e8f15 100644 bindLocal(ki, state, ConstantExpr::alloc(value, resultType)); break; -- -2.17.0 +2.17.1 diff --git a/0016-llvm50-AllocaInst-takes-address-space.patch b/0024-llvm50-AllocaInst-takes-address-space.patch similarity index 99% rename from 0016-llvm50-AllocaInst-takes-address-space.patch rename to 0024-llvm50-AllocaInst-takes-address-space.patch index 0e90c31..320a873 100644 --- a/0016-llvm50-AllocaInst-takes-address-space.patch +++ b/0024-llvm50-AllocaInst-takes-address-space.patch @@ -35,5 +35,5 @@ index ff87d210b863..c85fee861f03 100644 /* Insert void klee_init_env(int* argc, char*** argv) */ std::vector params; -- -2.17.0 +2.17.1 diff --git a/0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch b/0025-llvm50-Intrinsic-objectsize-has-three-arguments.patch similarity index 94% rename from 0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch rename to 0025-llvm50-Intrinsic-objectsize-has-three-arguments.patch index ee5862f..cb1d2c8 100644 --- a/0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch +++ b/0025-llvm50-Intrinsic-objectsize-has-three-arguments.patch @@ -14,10 +14,10 @@ Signed-off-by: Jiri Slaby 1 file changed, 16 insertions(+) diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp -index d4f93bdc591e..e8c63cd334d0 100644 +index 4d323b8e8344..e32eeb5880e6 100644 --- a/lib/Module/IntrinsicCleaner.cpp +++ b/lib/Module/IntrinsicCleaner.cpp -@@ -230,13 +230,29 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) { +@@ -226,13 +226,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. @@ -48,5 +48,5 @@ index d4f93bdc591e..e8c63cd334d0 100644 IntegerType *intType = dyn_cast(ii->getType()); assert(intType && "intrinsic does not have integer return type"); -- -2.17.0 +2.17.1 diff --git a/0018-llvm50-test-change-objectsize.patch b/0026-llvm50-test-change-objectsize.patch similarity index 99% rename from 0018-llvm50-test-change-objectsize.patch rename to 0026-llvm50-test-change-objectsize.patch index 9b82ce8..900d2f3 100644 --- a/0018-llvm50-test-change-objectsize.patch +++ b/0026-llvm50-test-change-objectsize.patch @@ -95,5 +95,5 @@ index 3a111f99c619..95070e66e45c 100644 declare void @abort() noreturn nounwind -- -2.17.0 +2.17.1 diff --git a/0027-llvm50-test-add-disable-O0-optnone-to-O0.patch b/0027-llvm50-test-add-disable-O0-optnone-to-O0.patch new file mode 100644 index 0000000..3c25384 --- /dev/null +++ b/0027-llvm50-test-add-disable-O0-optnone-to-O0.patch @@ -0,0 +1,1533 @@ +From: Jiri Slaby +Date: Sun, 27 May 2018 10:26:43 +0200 +Subject: llvm50: test, add -disable-O0-optnone to -O0 +Patch-mainline: no + +Otherwise optimizations done in klee won't have any effect. + +Signed-off-by: Jiri Slaby +--- + test/CXX/ArrayNew.cpp | 2 +- + test/CXX/New.cpp | 2 +- + test/CXX/SimpleVirtual.cpp | 2 +- + test/CXX/StaticConstructor.cpp | 2 +- + test/CXX/StaticDestructor.cpp | 2 +- + test/CXX/Trivial.cpp | 2 +- + test/Coverage/ReadArgs.c | 2 +- + test/Coverage/ReplayOutDir.c | 2 +- + test/Feature/AliasFunction.c | 2 +- + test/Feature/AliasFunctionExit.c | 2 +- + test/Feature/ByteSwap.c | 2 +- + test/Feature/CheckForImpliedValue.c.failing | 2 +- + test/Feature/CompressedExprLogging.c | 2 +- + test/Feature/DanglingConcreteReadExpr.c | 2 +- + test/Feature/DoubleFree.c | 2 +- + test/Feature/DumpStatesOnHalt.c | 2 +- + test/Feature/ExitOnErrorType.c | 2 +- + test/Feature/ExprLogging.c | 2 +- + test/Feature/FloatingPt.c | 2 +- + test/Feature/InAndOutOfBounds.c | 2 +- + test/Feature/IsSymbolic.c | 2 +- + test/Feature/KleeReportError.c | 2 +- + test/Feature/LargeReturnTypes.cpp | 2 +- + test/Feature/LinkLLVMLib.c | 4 ++-- + test/Feature/LongDouble.c | 2 +- + test/Feature/LongDoubleSupport.c | 2 +- + test/Feature/MultipleFreeResolution.c | 2 +- + test/Feature/MultipleReadResolution.c | 2 +- + test/Feature/MultipleReallocResolution.c | 2 +- + test/Feature/MultipleWriteResolution.c | 2 +- + test/Feature/OneFreeError.c | 2 +- + test/Feature/OneOutOfBounds.c | 2 +- + test/Feature/Optimize.c | 2 +- + test/Feature/OverlappedError.c | 2 +- + test/Feature/OvershiftCheck.c | 2 +- + test/Feature/PreferCex.c | 2 +- + test/Feature/RaiseAsm.c | 2 +- + test/Feature/Realloc.c | 2 +- + test/Feature/ReplayPath.c | 4 ++-- + test/Feature/RewriteEqualities.c | 2 +- + test/Feature/Searchers.c | 2 +- + test/Feature/SolverTimeout.c | 2 +- + test/Feature/SourceMapping.c | 2 +- + test/Feature/VarArgLongDouble.c | 2 +- + test/Feature/Vararg.c | 2 +- + test/Feature/WithLibc.c | 2 +- + test/Feature/arithmetic-right-overshift-sym-conc.c | 2 +- + test/Feature/consecutive_divide_by_zero.c | 2 +- + test/Feature/const_array_opt1.c | 2 +- + test/Feature/left-overshift-sym-conc.c | 2 +- + test/Feature/logical-right-overshift-sym-conc.c | 2 +- + test/Feature/srem.c | 2 +- + test/Feature/ubsan_signed_overflow.c | 2 +- + test/Feature/ubsan_unsigned_overflow.c | 2 +- + test/Programs/pcregrep.c | 2 +- + test/Replay/libkleeruntest/replay_invalid_klee_assume.c | 2 +- + test/Replay/libkleeruntest/replay_invalid_klee_choose.c | 2 +- + test/Replay/libkleeruntest/replay_invalid_klee_range.c | 2 +- + test/Replay/libkleeruntest/replay_invalid_num_objects.c | 2 +- + test/Replay/libkleeruntest/replay_invalid_object_names.c | 2 +- + test/Replay/libkleeruntest/replay_invalid_object_size.c | 2 +- + test/Replay/libkleeruntest/replay_klee_prefer_cex.c | 2 +- + test/Replay/libkleeruntest/replay_posix_runtime.c | 2 +- + test/Replay/libkleeruntest/replay_simple.c | 2 +- + test/Replay/libkleeruntest/replay_two_objects.c | 2 +- + test/Runtime/POSIX/DirConsistency.c | 4 ++-- + test/Runtime/POSIX/DirSeek.c | 2 +- + test/Runtime/POSIX/FDNumbers.c | 2 +- + test/Runtime/POSIX/FD_Fail.c | 2 +- + test/Runtime/POSIX/FD_Fail2.c | 2 +- + test/Runtime/POSIX/Fcntl.c | 2 +- + test/Runtime/POSIX/FilePerm.c | 2 +- + test/Runtime/POSIX/FileTime.c | 2 +- + test/Runtime/POSIX/FreeArgv.c | 2 +- + test/Runtime/POSIX/Futimesat.c | 2 +- + test/Runtime/POSIX/Getenv.c | 2 +- + test/Runtime/POSIX/Ioctl.c | 2 +- + test/Runtime/POSIX/Isatty.c | 2 +- + test/Runtime/POSIX/MixedConcreteSymbolic.c | 2 +- + test/Runtime/POSIX/Openat.c | 2 +- + test/Runtime/POSIX/PrgName.c | 2 +- + test/Runtime/POSIX/Read1.c | 2 +- + test/Runtime/POSIX/Replay.c | 2 +- + test/Runtime/POSIX/SELinux/SELinux.c | 2 +- + test/Runtime/POSIX/SeedAndFail.c | 2 +- + test/Runtime/POSIX/Stdin.c | 2 +- + test/Runtime/POSIX/Write1.c | 2 +- + test/Runtime/POSIX/Write2.c | 2 +- + .../2007-10-08-optimization-calls-wrong-libc-functions.c | 2 +- + test/Runtime/Uclibc/2008-03-04-libc-atexit-uses-dso-handle.c | 2 +- + test/Solver/Z3ConstantArray.c | 2 +- + test/VectorInstructions/extract_element.c | 2 +- + test/VectorInstructions/extract_element_symbolic.c | 2 +- + test/VectorInstructions/floating_point_ops_constant.c | 2 +- + test/VectorInstructions/insert_element.c | 2 +- + test/VectorInstructions/insert_element_symbolic.c | 2 +- + test/VectorInstructions/integer_ops_constant.c | 2 +- + test/VectorInstructions/integer_ops_signed_symbolic.c | 2 +- + test/VectorInstructions/integer_ops_unsigned_symbolic.c | 2 +- + test/VectorInstructions/shuffle_element.c | 2 +- + test/lit.cfg | 2 +- + test/lit.site.cfg.in | 4 ++++ + .../2007-07-25-invalid-stp-array-binding-to-objectstate.c | 2 +- + test/regression/2007-07-30-unflushed-byte.c | 2 +- + .../2007-08-01-cache-unclear-on-overwrite-flushed.c | 2 +- + test/regression/2007-08-06-64bit-shift.c | 2 +- + test/regression/2007-08-06-access-after-free.c | 2 +- + test/regression/2007-08-08-free-zero.c | 2 +- + test/regression/2007-08-16-valid-write-to-freed-object.c | 2 +- + test/regression/2007-10-11-free-of-alloca.c | 2 +- + test/regression/2007-10-12-failed-make-symbolic-after-copy.c | 2 +- + test/regression/2008-03-04-free-of-global.c | 2 +- + test/regression/2008-03-11-free-of-malloc-zero.c | 2 +- + test/regression/2008-04-10-bad-alloca-free.c | 2 +- + test/regression/2008-05-23-gep-with-global-const.c | 2 +- + test/regression/2012-05-13-asm-causes-aborts.c | 2 +- + test/regression/2014-07-04-unflushed-error-report.c | 2 +- + test/regression/2014-09-13-debug-info.c | 2 +- + test/regression/2014-12-08-ashr.c | 2 +- + test/regression/2015-06-22-struct-write.c | 2 +- + test/regression/2015-08-05-invalid-fork.c | 2 +- + test/regression/2015-08-30-empty-constraints.c | 2 +- + test/regression/2015-08-30-sdiv-1.c | 2 +- + test/regression/2016-04-14-sdiv-2.c | 2 +- + test/regression/2016-06-28-div-zero-bug.c | 2 +- + test/regression/2016-08-06-klee-get-obj-size.c | 2 +- + test/regression/2016-08-11-entry-point-internalize-pass.c | 2 +- + test/regression/2016-08-12-empty-file.c | 2 +- + test/regression/2016-11-24-bitcast-weak-alias.c | 2 +- + test/regression/2016-12-14-alloc-alignment.c | 2 +- + test/regression/2017-02-21-pathOS-id.c | 2 +- + test/regression/2017-03-23-early-exit-log-stats.c | 2 +- + .../regression/2018-05-05-number-instructions-dumped-states.c | 2 +- + 133 files changed, 139 insertions(+), 135 deletions(-) + +diff --git a/test/CXX/ArrayNew.cpp b/test/CXX/ArrayNew.cpp +index 6a54083aafac..baad95fe4473 100644 +--- a/test/CXX/ArrayNew.cpp ++++ b/test/CXX/ArrayNew.cpp +@@ -1,4 +1,4 @@ +-// RUN: %llvmgxx %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgxx %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --no-output --exit-on-error --no-externals %t1.bc + +diff --git a/test/CXX/New.cpp b/test/CXX/New.cpp +index 5b90c7a46dc4..71784f9f9598 100644 +--- a/test/CXX/New.cpp ++++ b/test/CXX/New.cpp +@@ -1,4 +1,4 @@ +-// RUN: %llvmgxx %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgxx %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --no-output --exit-on-error --no-externals %t1.bc + +diff --git a/test/CXX/SimpleVirtual.cpp b/test/CXX/SimpleVirtual.cpp +index b2db980dc7b7..7d0faa0842fc 100644 +--- a/test/CXX/SimpleVirtual.cpp ++++ b/test/CXX/SimpleVirtual.cpp +@@ -1,4 +1,4 @@ +-// RUN: %llvmgxx %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgxx %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --no-output --exit-on-error --no-externals %t1.bc + +diff --git a/test/CXX/StaticConstructor.cpp b/test/CXX/StaticConstructor.cpp +index 56fcb97be385..5332dc0b7846 100644 +--- a/test/CXX/StaticConstructor.cpp ++++ b/test/CXX/StaticConstructor.cpp +@@ -1,4 +1,4 @@ +-// RUN: %llvmgxx %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgxx %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --libc=klee --no-output --exit-on-error %t1.bc + +diff --git a/test/CXX/StaticDestructor.cpp b/test/CXX/StaticDestructor.cpp +index adc449a5c1f7..608525083bbb 100644 +--- a/test/CXX/StaticDestructor.cpp ++++ b/test/CXX/StaticDestructor.cpp +@@ -1,6 +1,6 @@ + // don't optimize this, llvm likes to turn the *p into unreachable + +-// RUN: %llvmgxx %s -emit-llvm -g -O0 -c -o %t1.bc ++// RUN: %llvmgxx %s -emit-llvm -g %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --optimize=false --libc=klee --no-output %t1.bc 2> %t1.log + // RUN: grep ":17: memory error" %t1.log +diff --git a/test/CXX/Trivial.cpp b/test/CXX/Trivial.cpp +index 2b8ceed36cb9..18845820c067 100644 +--- a/test/CXX/Trivial.cpp ++++ b/test/CXX/Trivial.cpp +@@ -1,4 +1,4 @@ +-// RUN: %llvmgxx %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgxx %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --no-output --exit-on-error %t1.bc + +diff --git a/test/Coverage/ReadArgs.c b/test/Coverage/ReadArgs.c +index 8eae53a1efbc..531cc0a1dfe5 100644 +--- a/test/Coverage/ReadArgs.c ++++ b/test/Coverage/ReadArgs.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: echo " --output-dir=%t.klee-out " > %t1.args + // RUN: %klee @%t1.args %t1.bc +diff --git a/test/Coverage/ReplayOutDir.c b/test/Coverage/ReplayOutDir.c +index d9bffea09660..fa06a2697c21 100644 +--- a/test/Coverage/ReplayOutDir.c ++++ b/test/Coverage/ReplayOutDir.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t1.out %t1.replay + // RUN: %klee --output-dir=%t1.out %t1.bc + // RUN: %klee --output-dir=%t1.replay --replay-ktest-dir=%t1.out %t1.bc +diff --git a/test/Feature/AliasFunction.c b/test/Feature/AliasFunction.c +index 019ebe674036..1fd9d0e51ee8 100644 +--- a/test/Feature/AliasFunction.c ++++ b/test/Feature/AliasFunction.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t1.bc > %t1.log + // RUN: grep -c foo %t1.log | grep 5 +diff --git a/test/Feature/AliasFunctionExit.c b/test/Feature/AliasFunctionExit.c +index 09ca8f469336..4f0f8359aa4a 100644 +--- a/test/Feature/AliasFunctionExit.c ++++ b/test/Feature/AliasFunctionExit.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t1.bc > %t1.log + // RUN: grep -c START %t1.log | grep 1 +diff --git a/test/Feature/ByteSwap.c b/test/Feature/ByteSwap.c +index a22289059bb2..da764fc0c7c9 100644 +--- a/test/Feature/ByteSwap.c ++++ b/test/Feature/ByteSwap.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --libc=klee --exit-on-error %t1.bc + +diff --git a/test/Feature/CheckForImpliedValue.c.failing b/test/Feature/CheckForImpliedValue.c.failing +index 0aa50f0bc1e8..2f45ec2e5261 100644 +--- a/test/Feature/CheckForImpliedValue.c.failing ++++ b/test/Feature/CheckForImpliedValue.c.failing +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -f %t1.log + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --log-file %t1.log --debug-check-for-implied-values %t1.bc +diff --git a/test/Feature/CompressedExprLogging.c b/test/Feature/CompressedExprLogging.c +index ba20428d9992..d2eafca8ebb4 100644 +--- a/test/Feature/CompressedExprLogging.c ++++ b/test/Feature/CompressedExprLogging.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t1.bc + // We disable the cex-cache to eliminate nondeterminism across different + // solvers, in particular when counting the number of queries in the last two + // commands +diff --git a/test/Feature/DanglingConcreteReadExpr.c b/test/Feature/DanglingConcreteReadExpr.c +index 861f93ebc4a6..d904fd984393 100644 +--- a/test/Feature/DanglingConcreteReadExpr.c ++++ b/test/Feature/DanglingConcreteReadExpr.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --optimize=false --output-dir=%t.klee-out %t1.bc + // RUN: grep "total queries = 2" %t.klee-out/info +diff --git a/test/Feature/DoubleFree.c b/test/Feature/DoubleFree.c +index b24de17d8bac..3dbe4b24975b 100644 +--- a/test/Feature/DoubleFree.c ++++ b/test/Feature/DoubleFree.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck %s + // RUN: test -f %t.klee-out/test000001.ptr.err +diff --git a/test/Feature/DumpStatesOnHalt.c b/test/Feature/DumpStatesOnHalt.c +index bc30245603be..2176779888e3 100644 +--- a/test/Feature/DumpStatesOnHalt.c ++++ b/test/Feature/DumpStatesOnHalt.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -g -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --stop-after-n-instructions=1 --dump-states-on-halt=true %t1.bc 2>&1 | FileCheck %s + // RUN: test -f %t.klee-out/test000001.ktest +diff --git a/test/Feature/ExitOnErrorType.c b/test/Feature/ExitOnErrorType.c +index a68a92e06f63..0cbde8aa2247 100644 +--- a/test/Feature/ExitOnErrorType.c ++++ b/test/Feature/ExitOnErrorType.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -g -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out -exit-on-error-type Assert %t1.bc 2>&1 + +diff --git a/test/Feature/ExprLogging.c b/test/Feature/ExprLogging.c +index a85afc1bf3ef..142c41674ea1 100644 +--- a/test/Feature/ExprLogging.c ++++ b/test/Feature/ExprLogging.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t1.bc + // We disable the cex-cache to eliminate nondeterminism across different solvers, in particular when counting the number of queries in the last two commands + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --use-cex-cache=false --use-query-log=all:kquery,all:smt2,solver:kquery,solver:smt2 --write-kqueries --write-cvcs --write-smt2s %t1.bc 2> %t2.log +diff --git a/test/Feature/FloatingPt.c b/test/Feature/FloatingPt.c +index be0879358028..e6e695ca2cb7 100644 +--- a/test/Feature/FloatingPt.c ++++ b/test/Feature/FloatingPt.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc + +diff --git a/test/Feature/InAndOutOfBounds.c b/test/Feature/InAndOutOfBounds.c +index 6eb8784a7353..5f10835f4a6d 100644 +--- a/test/Feature/InAndOutOfBounds.c ++++ b/test/Feature/InAndOutOfBounds.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -g -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck %s + // RUN: test -f %t.klee-out/test000001.ptr.err -o -f %t.klee-out/test000002.ptr.err +diff --git a/test/Feature/IsSymbolic.c b/test/Feature/IsSymbolic.c +index 02aa23320075..8e39b99ff894 100644 +--- a/test/Feature/IsSymbolic.c ++++ b/test/Feature/IsSymbolic.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t1.bc + +diff --git a/test/Feature/KleeReportError.c b/test/Feature/KleeReportError.c +index 4e21df1870f7..665d194607bd 100644 +--- a/test/Feature/KleeReportError.c ++++ b/test/Feature/KleeReportError.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t2.bc ++// RUN: %llvmgcc %s -g -emit-llvm %O0opt -c -o %t2.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --emit-all-errors %t2.bc 2>&1 | FileCheck %s + // RUN: ls %t.klee-out/ | grep .my.err | wc -l | grep 2 +diff --git a/test/Feature/LargeReturnTypes.cpp b/test/Feature/LargeReturnTypes.cpp +index 84119624372f..92be31c28043 100644 +--- a/test/Feature/LargeReturnTypes.cpp ++++ b/test/Feature/LargeReturnTypes.cpp +@@ -1,5 +1,5 @@ + // REQUIRES: not-darwin +-// RUN: %llvmgxx -g -fno-exceptions -emit-llvm -O0 -c -o %t.bc %s ++// RUN: %llvmgxx -g -fno-exceptions -emit-llvm %O0opt -c -o %t.bc %s + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --libc=klee --no-output --exit-on-error %t.bc > %t.log + +diff --git a/test/Feature/LinkLLVMLib.c b/test/Feature/LinkLLVMLib.c +index 349314099886..1ad0fd386662 100644 +--- a/test/Feature/LinkLLVMLib.c ++++ b/test/Feature/LinkLLVMLib.c +@@ -1,7 +1,7 @@ +-// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc -DLINK_LLVM_LIB_TEST_LIB ++// RUN: %llvmgcc %s -g -emit-llvm %O0opt -c -o %t1.bc -DLINK_LLVM_LIB_TEST_LIB + // RUN: %llvmar r %t1.a %t1.bc + // +-// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t2.bc -DLINK_LLVM_LIB_TEST_EXEC ++// RUN: %llvmgcc %s -g -emit-llvm %O0opt -c -o %t2.bc -DLINK_LLVM_LIB_TEST_EXEC + // RUN: rm -rf %t.klee-out + // RUN: %klee --link-llvm-lib %t1.a --output-dir=%t.klee-out --emit-all-errors --warnings-only-to-file=false %t2.bc 2>&1 | FileCheck %s + +diff --git a/test/Feature/LongDouble.c b/test/Feature/LongDouble.c +index f69582b87794..19f9360a6f5c 100644 +--- a/test/Feature/LongDouble.c ++++ b/test/Feature/LongDouble.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc -g -emit-llvm -O0 -c -o %t.bc %s ++// RUN: %llvmgcc -g -emit-llvm %O0opt -c -o %t.bc %s + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --libc=klee --no-output --exit-on-error %t.bc > %t.log + // RUN: FileCheck %s --input-file=%t.log +diff --git a/test/Feature/LongDoubleSupport.c b/test/Feature/LongDoubleSupport.c +index 4ea9daee629f..acde2d8ee5bf 100644 +--- a/test/Feature/LongDoubleSupport.c ++++ b/test/Feature/LongDoubleSupport.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --optimize=0 --exit-on-error %t1.bc > %t2.out + +diff --git a/test/Feature/MultipleFreeResolution.c b/test/Feature/MultipleFreeResolution.c +index 704057f93891..63b7c1ab3645 100644 +--- a/test/Feature/MultipleFreeResolution.c ++++ b/test/Feature/MultipleFreeResolution.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -g -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --emit-all-errors %t1.bc 2>&1 | FileCheck %s + // RUN: ls %t.klee-out/ | grep .ktest | wc -l | grep 4 +diff --git a/test/Feature/MultipleReadResolution.c b/test/Feature/MultipleReadResolution.c +index a586a3c8bd50..6226d64a9e4a 100644 +--- a/test/Feature/MultipleReadResolution.c ++++ b/test/Feature/MultipleReadResolution.c +@@ -2,7 +2,7 @@ + // RUN: echo "x" >> %t1.res + // RUN: echo "x" >> %t1.res + // RUN: echo "x" >> %t1.res +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t1.bc > %t1.log + // RUN: diff %t1.res %t1.log +diff --git a/test/Feature/MultipleReallocResolution.c b/test/Feature/MultipleReallocResolution.c +index a95d9d754cce..4db6be9f0332 100644 +--- a/test/Feature/MultipleReallocResolution.c ++++ b/test/Feature/MultipleReallocResolution.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t1.bc + // RUN: ls %t.klee-out/ | grep .err | wc -l | grep 2 +diff --git a/test/Feature/MultipleWriteResolution.c b/test/Feature/MultipleWriteResolution.c +index 5f9068360df5..22dd973047cc 100644 +--- a/test/Feature/MultipleWriteResolution.c ++++ b/test/Feature/MultipleWriteResolution.c +@@ -2,7 +2,7 @@ + // RUN: echo "x" >> %t1.res + // RUN: echo "x" >> %t1.res + // RUN: echo "x" >> %t1.res +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t1.bc > %t1.log + // RUN: diff %t1.res %t1.log +diff --git a/test/Feature/OneFreeError.c b/test/Feature/OneFreeError.c +index 4f5a8c8c0153..76e85d6b3516 100644 +--- a/test/Feature/OneFreeError.c ++++ b/test/Feature/OneFreeError.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -g -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck %s + // RUN: test -f %t.klee-out/test000001.ptr.err +diff --git a/test/Feature/OneOutOfBounds.c b/test/Feature/OneOutOfBounds.c +index 85fb2a79599e..444820c9b878 100644 +--- a/test/Feature/OneOutOfBounds.c ++++ b/test/Feature/OneOutOfBounds.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -g -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck %s + // RUN: test -f %t.klee-out/test000001.ptr.err +diff --git a/test/Feature/Optimize.c b/test/Feature/Optimize.c +index 9aa963efd9c3..c0eb2d33559c 100644 +--- a/test/Feature/Optimize.c ++++ b/test/Feature/Optimize.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t2.bc + // RUN: rm -f %t2.log + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --stop-after-n-instructions=100 --optimize %t2.bc > %t3.log +diff --git a/test/Feature/OverlappedError.c b/test/Feature/OverlappedError.c +index a1b31f57cbc1..d02d2229dc3a 100644 +--- a/test/Feature/OverlappedError.c ++++ b/test/Feature/OverlappedError.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -g -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t1.bc + // RUN: ls %t.klee-out/ | grep .ktest | wc -l | grep 4 +diff --git a/test/Feature/OvershiftCheck.c b/test/Feature/OvershiftCheck.c +index 09cbf8ba0f6b..00e5530ad8d5 100644 +--- a/test/Feature/OvershiftCheck.c ++++ b/test/Feature/OvershiftCheck.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out -check-overshift %t.bc 2> %t.log + // RUN: grep -c "overshift error" %t.log +diff --git a/test/Feature/PreferCex.c b/test/Feature/PreferCex.c +index a765eea8b4af..8d88a3ce79bc 100644 +--- a/test/Feature/PreferCex.c ++++ b/test/Feature/PreferCex.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc + // RUN: ktest-tool %t.klee-out/test000001.ktest | FileCheck %s +diff --git a/test/Feature/RaiseAsm.c b/test/Feature/RaiseAsm.c +index f8ba173a10cb..fb30ea5df148 100644 +--- a/test/Feature/RaiseAsm.c ++++ b/test/Feature/RaiseAsm.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc + +diff --git a/test/Feature/Realloc.c b/test/Feature/Realloc.c +index d0c85b212858..4f075e5e3bc9 100644 +--- a/test/Feature/Realloc.c ++++ b/test/Feature/Realloc.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --exit-on-error --warnings-only-to-file=false %t1.bc 2>&1 | FileCheck %s + +diff --git a/test/Feature/ReplayPath.c b/test/Feature/ReplayPath.c +index 4a973dfdfe63..558b0d3c672a 100644 +--- a/test/Feature/ReplayPath.c ++++ b/test/Feature/ReplayPath.c +@@ -1,8 +1,8 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -DCOND_EXIT -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -DCOND_EXIT -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --write-paths %t1.bc > %t3.good + +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t2.bc + // RUN: rm -rf %t.klee-out-2 + // RUN: %klee --output-dir=%t.klee-out-2 --replay-path %t.klee-out/test000001.path %t2.bc > %t3.log + // RUN: diff %t3.log %t3.good +diff --git a/test/Feature/RewriteEqualities.c b/test/Feature/RewriteEqualities.c +index b3cc0ef78eae..5384c5c8faac 100644 +--- a/test/Feature/RewriteEqualities.c ++++ b/test/Feature/RewriteEqualities.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --search=dfs --write-kqueries --rewrite-equalities=false %t.bc + // RUN: grep "N0:(Read w8 2 x)" %t.klee-out/test000003.kquery +diff --git a/test/Feature/Searchers.c b/test/Feature/Searchers.c +index a24cb7a306d1..efc2f376e2f6 100644 +--- a/test/Feature/Searchers.c ++++ b/test/Feature/Searchers.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t2.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t2.bc + // RUN: rm -rf %t.klee-out +diff --git a/test/Feature/SolverTimeout.c b/test/Feature/SolverTimeout.c +index aa86a856d299..a2faf08a81ee 100644 +--- a/test/Feature/SolverTimeout.c ++++ b/test/Feature/SolverTimeout.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --max-solver-time=1 %t1.bc + // FIXME: This test occasionally fails when using Z3 4.4.1 but +diff --git a/test/Feature/SourceMapping.c b/test/Feature/SourceMapping.c +index 9835d7018b97..1927d2d6b8da 100644 +--- a/test/Feature/SourceMapping.c ++++ b/test/Feature/SourceMapping.c +@@ -1,7 +1,7 @@ + // Check that we properly associate instruction level statistics with source + // file and line. + // +-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc + // RUN: FileCheck < %t.klee-out/run.istats %s +diff --git a/test/Feature/VarArgLongDouble.c b/test/Feature/VarArgLongDouble.c +index ae5531319d45..63ba85c8a337 100644 +--- a/test/Feature/VarArgLongDouble.c ++++ b/test/Feature/VarArgLongDouble.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t.bc | FileCheck %s + +diff --git a/test/Feature/Vararg.c b/test/Feature/Vararg.c +index a78b784e3f62..11416c3730aa 100644 +--- a/test/Feature/Vararg.c ++++ b/test/Feature/Vararg.c +@@ -1,5 +1,5 @@ + // REQUIRES: not-darwin +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t1.bc > %t2.out + // RUN: grep "types: (52, 37, 2.00, (9,12,15))" %t2.out +diff --git a/test/Feature/WithLibc.c b/test/Feature/WithLibc.c +index 0eca8213f384..8c07041d89f6 100644 +--- a/test/Feature/WithLibc.c ++++ b/test/Feature/WithLibc.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t2.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --libc=klee %t2.bc > %t3.log + // RUN: echo "good" > %t3.good +diff --git a/test/Feature/arithmetic-right-overshift-sym-conc.c b/test/Feature/arithmetic-right-overshift-sym-conc.c +index 63b93db32ed9..2fff2a3a2724 100644 +--- a/test/Feature/arithmetic-right-overshift-sym-conc.c ++++ b/test/Feature/arithmetic-right-overshift-sym-conc.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out -use-cex-cache=1 -check-overshift=0 %t.bc + // RUN: not grep "ASSERTION FAIL" %t.klee-out/messages.txt +diff --git a/test/Feature/consecutive_divide_by_zero.c b/test/Feature/consecutive_divide_by_zero.c +index 31124ea4611c..157f5e1cf604 100644 +--- a/test/Feature/consecutive_divide_by_zero.c ++++ b/test/Feature/consecutive_divide_by_zero.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc -emit-llvm -c -g -O0 %s -o %t.bc ++// RUN: %llvmgcc -emit-llvm -c -g %O0opt %s -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out -check-div-zero -emit-all-errors=0 %t.bc 2> %t.log + // RUN: grep "completed paths = 3" %t.log +diff --git a/test/Feature/const_array_opt1.c b/test/Feature/const_array_opt1.c +index ac43bdf7fd4b..b466e56ce784 100644 +--- a/test/Feature/const_array_opt1.c ++++ b/test/Feature/const_array_opt1.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --const-array-opt --max-time=10 --only-output-states-covering-new %t.bc >%t.log + // grep -q "Finished successfully!\n" +diff --git a/test/Feature/left-overshift-sym-conc.c b/test/Feature/left-overshift-sym-conc.c +index 8859c46cae71..05b89c683381 100644 +--- a/test/Feature/left-overshift-sym-conc.c ++++ b/test/Feature/left-overshift-sym-conc.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out -use-cex-cache=1 -check-overshift=0 %t.bc + // RUN: not grep "ASSERTION FAIL" %t.klee-out/messages.txt +diff --git a/test/Feature/logical-right-overshift-sym-conc.c b/test/Feature/logical-right-overshift-sym-conc.c +index 950b5992ccd0..b499cce6f46f 100644 +--- a/test/Feature/logical-right-overshift-sym-conc.c ++++ b/test/Feature/logical-right-overshift-sym-conc.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out -use-cex-cache=1 -check-overshift=0 %t.bc + // RUN: not grep "ASSERTION FAIL" %t.klee-out/messages.txt +diff --git a/test/Feature/srem.c b/test/Feature/srem.c +index f4fa8aa5c4b7..4c331dd0e76b 100644 +--- a/test/Feature/srem.c ++++ b/test/Feature/srem.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out -use-cex-cache=1 %t.bc + // RUN: grep "KLEE: done: explored paths = 5" %t.klee-out/info +diff --git a/test/Feature/ubsan_signed_overflow.c b/test/Feature/ubsan_signed_overflow.c +index c89065ebf957..03073ae7f39e 100644 +--- a/test/Feature/ubsan_signed_overflow.c ++++ b/test/Feature/ubsan_signed_overflow.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -fsanitize=signed-integer-overflow -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -fsanitize=signed-integer-overflow -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t.bc 2>&1 | FileCheck %s + +diff --git a/test/Feature/ubsan_unsigned_overflow.c b/test/Feature/ubsan_unsigned_overflow.c +index 1300ffcc195c..c96909bb3a66 100644 +--- a/test/Feature/ubsan_unsigned_overflow.c ++++ b/test/Feature/ubsan_unsigned_overflow.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -fsanitize=unsigned-integer-overflow -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -fsanitize=unsigned-integer-overflow -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t.bc 2>&1 | FileCheck %s + +diff --git a/test/Programs/pcregrep.c b/test/Programs/pcregrep.c +index 634e1cc626d7..e2cb5362d089 100644 +--- a/test/Programs/pcregrep.c ++++ b/test/Programs/pcregrep.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc -m32 %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc -m32 %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --libc=klee --exit-on-error %t1.bc 2 2 + // XFAIL: x86_64 +diff --git a/test/Replay/libkleeruntest/replay_invalid_klee_assume.c b/test/Replay/libkleeruntest/replay_invalid_klee_assume.c +index 10da56152bcf..2257d31d07da 100644 +--- a/test/Replay/libkleeruntest/replay_invalid_klee_assume.c ++++ b/test/Replay/libkleeruntest/replay_invalid_klee_assume.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc -DASSUME_VALUE=1 %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc -DASSUME_VALUE=1 %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --search=dfs %t.bc + // RUN: test -f %t.klee-out/test000001.ktest +diff --git a/test/Replay/libkleeruntest/replay_invalid_klee_choose.c b/test/Replay/libkleeruntest/replay_invalid_klee_choose.c +index c64f913d7a1b..4cc3676591fa 100644 +--- a/test/Replay/libkleeruntest/replay_invalid_klee_choose.c ++++ b/test/Replay/libkleeruntest/replay_invalid_klee_choose.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc -DBOUND_VALUE=32 -DFORCE_VALUE=20 %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc -DBOUND_VALUE=32 -DFORCE_VALUE=20 %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --search=dfs %t.bc + // RUN: test -f %t.klee-out/test000001.ktest +diff --git a/test/Replay/libkleeruntest/replay_invalid_klee_range.c b/test/Replay/libkleeruntest/replay_invalid_klee_range.c +index 6542199e931e..7ae348996fea 100644 +--- a/test/Replay/libkleeruntest/replay_invalid_klee_range.c ++++ b/test/Replay/libkleeruntest/replay_invalid_klee_range.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc -DBOUND_VALUE=32 -DFORCE_VALUE=20 %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc -DBOUND_VALUE=32 -DFORCE_VALUE=20 %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --libc=klee --search=dfs %t.bc + // RUN: test -f %t.klee-out/test000001.ktest +diff --git a/test/Replay/libkleeruntest/replay_invalid_num_objects.c b/test/Replay/libkleeruntest/replay_invalid_num_objects.c +index 39b389df42f4..438830678ab0 100644 +--- a/test/Replay/libkleeruntest/replay_invalid_num_objects.c ++++ b/test/Replay/libkleeruntest/replay_invalid_num_objects.c +@@ -1,5 +1,5 @@ + // Compile program that only makes one klee_make_symbolic() call +-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --search=dfs %t.bc + // RUN: test -f %t.klee-out/test000001.ktest +diff --git a/test/Replay/libkleeruntest/replay_invalid_object_names.c b/test/Replay/libkleeruntest/replay_invalid_object_names.c +index 0285024c9746..67383a360b3a 100644 +--- a/test/Replay/libkleeruntest/replay_invalid_object_names.c ++++ b/test/Replay/libkleeruntest/replay_invalid_object_names.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc -DOBJ_NAME=simple_name %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc -DOBJ_NAME=simple_name %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --search=dfs %t.bc + // RUN: test -f %t.klee-out/test000001.ktest +diff --git a/test/Replay/libkleeruntest/replay_invalid_object_size.c b/test/Replay/libkleeruntest/replay_invalid_object_size.c +index 504a3bd07e27..7619cd62c339 100644 +--- a/test/Replay/libkleeruntest/replay_invalid_object_size.c ++++ b/test/Replay/libkleeruntest/replay_invalid_object_size.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc -DINT_TYPE=uint8_t %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc -DINT_TYPE=uint8_t %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --search=dfs %t.bc + // RUN: test -f %t.klee-out/test000001.ktest +diff --git a/test/Replay/libkleeruntest/replay_klee_prefer_cex.c b/test/Replay/libkleeruntest/replay_klee_prefer_cex.c +index df441ea8347b..852554b0e3b2 100644 +--- a/test/Replay/libkleeruntest/replay_klee_prefer_cex.c ++++ b/test/Replay/libkleeruntest/replay_klee_prefer_cex.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t.bc + +diff --git a/test/Replay/libkleeruntest/replay_posix_runtime.c b/test/Replay/libkleeruntest/replay_posix_runtime.c +index ac56179b03b4..5956c918e811 100644 +--- a/test/Replay/libkleeruntest/replay_posix_runtime.c ++++ b/test/Replay/libkleeruntest/replay_posix_runtime.c +@@ -1,6 +1,6 @@ + // REQUIRES: posix-runtime + // FIXME: We need to fix a bug in libkleeRuntest +-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --posix-runtime --search=dfs %t.bc + // RUN: test -f %t.klee-out/test000001.ktest +diff --git a/test/Replay/libkleeruntest/replay_simple.c b/test/Replay/libkleeruntest/replay_simple.c +index 77e2f5d2567f..8155060d4266 100644 +--- a/test/Replay/libkleeruntest/replay_simple.c ++++ b/test/Replay/libkleeruntest/replay_simple.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --search=dfs %t.bc + // RUN: test -f %t.klee-out/test000001.ktest +diff --git a/test/Replay/libkleeruntest/replay_two_objects.c b/test/Replay/libkleeruntest/replay_two_objects.c +index 779e1b656eb6..692797e1fdc0 100644 +--- a/test/Replay/libkleeruntest/replay_two_objects.c ++++ b/test/Replay/libkleeruntest/replay_two_objects.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --search=dfs %t.bc 2>&1 | FileCheck %s + // RUN: test -f %t.klee-out/test000001.ktest +diff --git a/test/Runtime/POSIX/DirConsistency.c b/test/Runtime/POSIX/DirConsistency.c +index 8faa9778ca41..43216d5470b5 100644 +--- a/test/Runtime/POSIX/DirConsistency.c ++++ b/test/Runtime/POSIX/DirConsistency.c +@@ -1,8 +1,8 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out %t.klee-out-tmp + // RUN: %gentmp %t.klee-out-tmp + // RUN: %klee --output-dir=%t.klee-out --run-in=%t.klee-out-tmp --search=random-state --libc=uclibc --posix-runtime --exit-on-error %t.bc --sym-files 1 1 > %t1.log +-// RUN: %llvmgcc -D_FILE_OFFSET_BITS=64 %s -emit-llvm -O0 -c -o %t.bc ++// RUN: %llvmgcc -D_FILE_OFFSET_BITS=64 %s -emit-llvm %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out %t.klee-out-tmp + // RUN: %gentmp %t.klee-out-tmp + // RUN: %klee --output-dir=%t.klee-out --run-in=%t.klee-out-tmp --search=random-state --libc=uclibc --posix-runtime --exit-on-error %t.bc --sym-files 1 1 > %t2.log +diff --git a/test/Runtime/POSIX/DirSeek.c b/test/Runtime/POSIX/DirSeek.c +index 4c68a30c546c..4cb91b7016e0 100644 +--- a/test/Runtime/POSIX/DirSeek.c ++++ b/test/Runtime/POSIX/DirSeek.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -g -o %t2.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -g -o %t2.bc + // RUN: rm -rf %t.klee-out %t.klee-out-tmp + // RUN: %gentmp %t.klee-out-tmp + // RUN: %klee --output-dir=%t.klee-out --run-in=%t.klee-out-tmp --libc=uclibc --posix-runtime --exit-on-error %t2.bc --sym-files 2 2 +diff --git a/test/Runtime/POSIX/FDNumbers.c b/test/Runtime/POSIX/FDNumbers.c +index c012174cdc1f..dc5e17344ed4 100644 +--- a/test/Runtime/POSIX/FDNumbers.c ++++ b/test/Runtime/POSIX/FDNumbers.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t2.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t2.bc --sym-files 1 10 + +diff --git a/test/Runtime/POSIX/FD_Fail.c b/test/Runtime/POSIX/FD_Fail.c +index 2ee1a1a260d6..9a73e60f202e 100644 +--- a/test/Runtime/POSIX/FD_Fail.c ++++ b/test/Runtime/POSIX/FD_Fail.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --libc=uclibc --posix-runtime %t1.bc --sym-files 0 0 --max-fail 1 > %t.log + // RUN: grep -q "fread(): ok" %t.log +diff --git a/test/Runtime/POSIX/FD_Fail2.c b/test/Runtime/POSIX/FD_Fail2.c +index c1c2cc5fd9de..8fef1eda6df1 100644 +--- a/test/Runtime/POSIX/FD_Fail2.c ++++ b/test/Runtime/POSIX/FD_Fail2.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --libc=uclibc --posix-runtime --search=dfs %t1.bc --sym-files 1 10 --max-fail 2 + // +diff --git a/test/Runtime/POSIX/Fcntl.c b/test/Runtime/POSIX/Fcntl.c +index 13f6de781dce..e7a4cc4f31d3 100644 +--- a/test/Runtime/POSIX/Fcntl.c ++++ b/test/Runtime/POSIX/Fcntl.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t2.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t2.bc --sym-files 1 10 + +diff --git a/test/Runtime/POSIX/FilePerm.c b/test/Runtime/POSIX/FilePerm.c +index c66e35de0cce..2a18037f46f5 100644 +--- a/test/Runtime/POSIX/FilePerm.c ++++ b/test/Runtime/POSIX/FilePerm.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --posix-runtime %t.bc --sym-files 1 10 --sym-stdout 2>%t.log + // RUN: test -f %t.klee-out/test000001.ktest +diff --git a/test/Runtime/POSIX/FileTime.c b/test/Runtime/POSIX/FileTime.c +index 489c09ed9ff2..34fd346865fb 100644 +--- a/test/Runtime/POSIX/FileTime.c ++++ b/test/Runtime/POSIX/FileTime.c +@@ -1,5 +1,5 @@ + // Tests the functionality of setting and getting file access and modification times +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --libc=uclibc --posix-runtime %t1.bc --sym-files 1 1 + +diff --git a/test/Runtime/POSIX/FreeArgv.c b/test/Runtime/POSIX/FreeArgv.c +index 8f812b5d946f..ff07024358d5 100644 +--- a/test/Runtime/POSIX/FreeArgv.c ++++ b/test/Runtime/POSIX/FreeArgv.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -g -emit-llvm %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --posix-runtime %t.bc --sym-args 1 1 1 2>&1 | FileCheck %s + // RUN: test -f %t.klee-out/test000001.free.err +diff --git a/test/Runtime/POSIX/Futimesat.c b/test/Runtime/POSIX/Futimesat.c +index a6d9dc048a7a..eecaa8808d1d 100644 +--- a/test/Runtime/POSIX/Futimesat.c ++++ b/test/Runtime/POSIX/Futimesat.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -DTDIR=%T -o %t2.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -DTDIR=%T -o %t2.bc + // RUN: touch %T/futimesat-dummy + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t2.bc --sym-files 1 10 +diff --git a/test/Runtime/POSIX/Getenv.c b/test/Runtime/POSIX/Getenv.c +index eb3a611a2be5..7b890b6729b9 100644 +--- a/test/Runtime/POSIX/Getenv.c ++++ b/test/Runtime/POSIX/Getenv.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t2.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --libc=klee --posix-runtime --exit-on-error %t2.bc --sym-files 1 10 + +diff --git a/test/Runtime/POSIX/Ioctl.c b/test/Runtime/POSIX/Ioctl.c +index f1caaf77dea2..8ab5d49ac8fc 100644 +--- a/test/Runtime/POSIX/Ioctl.c ++++ b/test/Runtime/POSIX/Ioctl.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t.bc --sym-files 0 4 + +diff --git a/test/Runtime/POSIX/Isatty.c b/test/Runtime/POSIX/Isatty.c +index fdfc6ceb0301..7fe44dcf031a 100644 +--- a/test/Runtime/POSIX/Isatty.c ++++ b/test/Runtime/POSIX/Isatty.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --libc=uclibc --posix-runtime %t.bc --sym-stdin 10 --sym-stdout > %t.log 2>&1 + // RUN: test -f %t.klee-out/test000001.ktest +diff --git a/test/Runtime/POSIX/MixedConcreteSymbolic.c b/test/Runtime/POSIX/MixedConcreteSymbolic.c +index 48e06934f60d..c32a8f546719 100644 +--- a/test/Runtime/POSIX/MixedConcreteSymbolic.c ++++ b/test/Runtime/POSIX/MixedConcreteSymbolic.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out -allow-external-sym-calls --exit-on-error --libc=uclibc --posix-runtime %t.bc --sym-stdin 10 2>%t.log | FileCheck %s + +diff --git a/test/Runtime/POSIX/Openat.c b/test/Runtime/POSIX/Openat.c +index c46c1269b2e4..648380dc2cdf 100644 +--- a/test/Runtime/POSIX/Openat.c ++++ b/test/Runtime/POSIX/Openat.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t2.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t2.bc --sym-files 1 10 + // RUN: test -f %t.klee-out/test000001.ktest +diff --git a/test/Runtime/POSIX/PrgName.c b/test/Runtime/POSIX/PrgName.c +index d62fe0fab353..2273c0d06fc2 100644 +--- a/test/Runtime/POSIX/PrgName.c ++++ b/test/Runtime/POSIX/PrgName.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t2.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t2.bc --sym-arg 10 >%t.log + // RUN: test -f %t.klee-out/test000001.ktest +diff --git a/test/Runtime/POSIX/Read1.c b/test/Runtime/POSIX/Read1.c +index 2b8cfa9d3858..00deab5f08e2 100644 +--- a/test/Runtime/POSIX/Read1.c ++++ b/test/Runtime/POSIX/Read1.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --exit-on-error --posix-runtime %t.bc --sym-files 1 8 >%t.log + +diff --git a/test/Runtime/POSIX/Replay.c b/test/Runtime/POSIX/Replay.c +index ba11f05f169b..eba6bbaf04d4 100644 +--- a/test/Runtime/POSIX/Replay.c ++++ b/test/Runtime/POSIX/Replay.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc -DKLEE_EXECUTION %s -emit-llvm -O0 -c -o %t.bc ++// RUN: %llvmgcc -DKLEE_EXECUTION %s -emit-llvm %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --posix-runtime %t.bc --sym-files 1 3 + // RUN: %klee-replay --create-files-only %t.klee-out/test000001.ktest +diff --git a/test/Runtime/POSIX/SELinux/SELinux.c b/test/Runtime/POSIX/SELinux/SELinux.c +index 21bebc4dd97f..d3a73e724002 100644 +--- a/test/Runtime/POSIX/SELinux/SELinux.c ++++ b/test/Runtime/POSIX/SELinux/SELinux.c +@@ -1,5 +1,5 @@ + /* Very basic test, as right now SELinux support is extremely basic */ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t1.bc --sym-arg 2 > %t.log + // XFAIL: no-selinux +diff --git a/test/Runtime/POSIX/SeedAndFail.c b/test/Runtime/POSIX/SeedAndFail.c +index 964ec500501e..891921f0ee22 100644 +--- a/test/Runtime/POSIX/SeedAndFail.c ++++ b/test/Runtime/POSIX/SeedAndFail.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --libc=uclibc --posix-runtime %t.bc --sym-files 1 10 2>%t.log + // RUN: rm -rf %t.klee-out-2 +diff --git a/test/Runtime/POSIX/Stdin.c b/test/Runtime/POSIX/Stdin.c +index 09eed6d2aee4..036fecaa17d3 100644 +--- a/test/Runtime/POSIX/Stdin.c ++++ b/test/Runtime/POSIX/Stdin.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --libc=uclibc --posix-runtime --exit-on-error %t.bc --sym-stdin 4 > %t.log + // RUN: grep "mode:file" %t.log +diff --git a/test/Runtime/POSIX/Write1.c b/test/Runtime/POSIX/Write1.c +index d260f2c34cc0..19b3e81fac27 100644 +--- a/test/Runtime/POSIX/Write1.c ++++ b/test/Runtime/POSIX/Write1.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --exit-on-error --libc=uclibc --posix-runtime %t.bc --sym-files 1 10 --sym-stdout 2>%t.log + +diff --git a/test/Runtime/POSIX/Write2.c b/test/Runtime/POSIX/Write2.c +index edb3e5b2aa6d..03501c3a2361 100644 +--- a/test/Runtime/POSIX/Write2.c ++++ b/test/Runtime/POSIX/Write2.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --exit-on-error --libc=uclibc --posix-runtime %t.bc --sym-files 1 10 --sym-stdout 2>%t.log + +diff --git a/test/Runtime/Uclibc/2007-10-08-optimization-calls-wrong-libc-functions.c b/test/Runtime/Uclibc/2007-10-08-optimization-calls-wrong-libc-functions.c +index d82f0eb9a60d..f3de99c1e27c 100644 +--- a/test/Runtime/Uclibc/2007-10-08-optimization-calls-wrong-libc-functions.c ++++ b/test/Runtime/Uclibc/2007-10-08-optimization-calls-wrong-libc-functions.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --exit-on-error --optimize --libc=uclibc %t1.bc + +diff --git a/test/Runtime/Uclibc/2008-03-04-libc-atexit-uses-dso-handle.c b/test/Runtime/Uclibc/2008-03-04-libc-atexit-uses-dso-handle.c +index 47ee3a4d05c5..299cbb12c871 100644 +--- a/test/Runtime/Uclibc/2008-03-04-libc-atexit-uses-dso-handle.c ++++ b/test/Runtime/Uclibc/2008-03-04-libc-atexit-uses-dso-handle.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --exit-on-error --libc=uclibc %t1.bc + +diff --git a/test/Solver/Z3ConstantArray.c b/test/Solver/Z3ConstantArray.c +index 482679e923ef..041e675dc4f1 100644 +--- a/test/Solver/Z3ConstantArray.c ++++ b/test/Solver/Z3ConstantArray.c +@@ -1,5 +1,5 @@ + // REQUIRES: z3 +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out -solver-backend=z3 -write-cvcs -write-smt2s -debug-z3-dump-queries=%t.smt2 %t1.bc + // RUN: cat %t.klee-out/test000001.smt2 | FileCheck --check-prefix=TEST-CASE %s +diff --git a/test/VectorInstructions/extract_element.c b/test/VectorInstructions/extract_element.c +index 008691e39a6d..0a5f155a1538 100644 +--- a/test/VectorInstructions/extract_element.c ++++ b/test/VectorInstructions/extract_element.c +@@ -1,5 +1,5 @@ + // REQUIRES: geq-llvm-3.4 +-// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // NOTE: Have to pass `--optimize=false` to avoid vector operations being + // constant folded away. +diff --git a/test/VectorInstructions/extract_element_symbolic.c b/test/VectorInstructions/extract_element_symbolic.c +index f75bad623a5e..c20536d457c2 100644 +--- a/test/VectorInstructions/extract_element_symbolic.c ++++ b/test/VectorInstructions/extract_element_symbolic.c +@@ -1,5 +1,5 @@ + // REQUIRES: geq-llvm-3.4 +-// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: not %klee --output-dir=%t.klee-out --exit-on-error %t1.bc > %t.log 2>&1 + // RUN: FileCheck -input-file=%t.log %s +diff --git a/test/VectorInstructions/floating_point_ops_constant.c b/test/VectorInstructions/floating_point_ops_constant.c +index 4e567a309580..ddb4af43e4c1 100644 +--- a/test/VectorInstructions/floating_point_ops_constant.c ++++ b/test/VectorInstructions/floating_point_ops_constant.c +@@ -1,5 +1,5 @@ + // REQUIRES: geq-llvm-3.4 +-// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // NOTE: Have to pass `--optimize=false` to avoid vector operations being + // constant folded away. +diff --git a/test/VectorInstructions/insert_element.c b/test/VectorInstructions/insert_element.c +index 8397dcebbcf0..6b77ab13d203 100644 +--- a/test/VectorInstructions/insert_element.c ++++ b/test/VectorInstructions/insert_element.c +@@ -1,5 +1,5 @@ + // REQUIRES: geq-llvm-3.4 +-// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // NOTE: Have to pass `--optimize=false` to avoid vector operations being + // constant folded away. +diff --git a/test/VectorInstructions/insert_element_symbolic.c b/test/VectorInstructions/insert_element_symbolic.c +index 76df899c95fa..1080f367efd0 100644 +--- a/test/VectorInstructions/insert_element_symbolic.c ++++ b/test/VectorInstructions/insert_element_symbolic.c +@@ -1,5 +1,5 @@ + // REQUIRES: geq-llvm-3.4 +-// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: not %klee --output-dir=%t.klee-out --exit-on-error %t1.bc > %t.log 2>&1 + // RUN: FileCheck -input-file=%t.log %s +diff --git a/test/VectorInstructions/integer_ops_constant.c b/test/VectorInstructions/integer_ops_constant.c +index 189ad4eeed54..355075e6375b 100644 +--- a/test/VectorInstructions/integer_ops_constant.c ++++ b/test/VectorInstructions/integer_ops_constant.c +@@ -1,5 +1,5 @@ + // REQUIRES: geq-llvm-3.4 +-// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // NOTE: Have to pass `--optimize=false` to avoid vector operations being + // constant folded away. +diff --git a/test/VectorInstructions/integer_ops_signed_symbolic.c b/test/VectorInstructions/integer_ops_signed_symbolic.c +index 80f4e420561b..7d9944222eff 100644 +--- a/test/VectorInstructions/integer_ops_signed_symbolic.c ++++ b/test/VectorInstructions/integer_ops_signed_symbolic.c +@@ -1,5 +1,5 @@ + // REQUIRES: geq-llvm-3.4 +-// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // NOTE: Have to pass `--optimize=false` to avoid vector operations being + // optimized away. +diff --git a/test/VectorInstructions/integer_ops_unsigned_symbolic.c b/test/VectorInstructions/integer_ops_unsigned_symbolic.c +index 56b1739809d6..794716761a87 100644 +--- a/test/VectorInstructions/integer_ops_unsigned_symbolic.c ++++ b/test/VectorInstructions/integer_ops_unsigned_symbolic.c +@@ -1,5 +1,5 @@ + // REQUIRES: geq-llvm-3.4 +-// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // NOTE: Have to pass `--optimize=false` to avoid vector operations being + // optimized away. +diff --git a/test/VectorInstructions/shuffle_element.c b/test/VectorInstructions/shuffle_element.c +index cf991b036983..55955fd347e9 100644 +--- a/test/VectorInstructions/shuffle_element.c ++++ b/test/VectorInstructions/shuffle_element.c +@@ -1,5 +1,5 @@ + // REQUIRES: geq-llvm-3.4 +-// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // NOTE: Have to pass `--optimize=false` to avoid vector operations being + // constant folded away. +diff --git a/test/lit.cfg b/test/lit.cfg +index e570f9b227e3..a26f9c0381d3 100644 +--- a/test/lit.cfg ++++ b/test/lit.cfg +@@ -84,7 +84,7 @@ if config.test_exec_root is None: + + + # Add substitutions from lit.site.cfg +-subs = [ 'llvmgcc', 'llvmgxx', 'cc', 'cxx'] ++subs = [ 'llvmgcc', 'llvmgxx', 'cc', 'cxx', 'O0opt' ] + for name in subs: + value = getattr(config, name, None) + if value == None: +diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in +index 300c70c53c2d..1f4b8c72d1b5 100644 +--- a/test/lit.site.cfg.in ++++ b/test/lit.site.cfg.in +@@ -21,6 +21,10 @@ config.llvmgxx = "@LLVMCXX@" + config.cc = "@NATIVE_CC@" + config.cxx = "@NATIVE_CXX@" + ++config.O0opt = "-O0" ++if @LLVM_VERSION_MAJOR@ >= 5: ++ config.O0opt += " -Xclang -disable-O0-optnone" ++ + # Features + config.enable_uclibc = True if @ENABLE_UCLIBC@ == 1 else False + config.enable_posix_runtime = True if @ENABLE_POSIX_RUNTIME@ == 1 else False +diff --git a/test/regression/2007-07-25-invalid-stp-array-binding-to-objectstate.c b/test/regression/2007-07-25-invalid-stp-array-binding-to-objectstate.c +index 9b06a797112b..e933d926eab1 100644 +--- a/test/regression/2007-07-25-invalid-stp-array-binding-to-objectstate.c ++++ b/test/regression/2007-07-25-invalid-stp-array-binding-to-objectstate.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t1.bc + +diff --git a/test/regression/2007-07-30-unflushed-byte.c b/test/regression/2007-07-30-unflushed-byte.c +index b9f6b2377472..ddbfecd7581b 100644 +--- a/test/regression/2007-07-30-unflushed-byte.c ++++ b/test/regression/2007-07-30-unflushed-byte.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t1.bc + +diff --git a/test/regression/2007-08-01-cache-unclear-on-overwrite-flushed.c b/test/regression/2007-08-01-cache-unclear-on-overwrite-flushed.c +index 47cd87d8d041..050b6393306a 100644 +--- a/test/regression/2007-08-01-cache-unclear-on-overwrite-flushed.c ++++ b/test/regression/2007-08-01-cache-unclear-on-overwrite-flushed.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t1.bc + +diff --git a/test/regression/2007-08-06-64bit-shift.c b/test/regression/2007-08-06-64bit-shift.c +index c6c1f34d7a3b..95a719a7d729 100644 +--- a/test/regression/2007-08-06-64bit-shift.c ++++ b/test/regression/2007-08-06-64bit-shift.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t1.bc + +diff --git a/test/regression/2007-08-06-access-after-free.c b/test/regression/2007-08-06-access-after-free.c +index 783b38858f1a..bba7b97cb1ab 100644 +--- a/test/regression/2007-08-06-access-after-free.c ++++ b/test/regression/2007-08-06-access-after-free.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t1.bc + +diff --git a/test/regression/2007-08-08-free-zero.c b/test/regression/2007-08-08-free-zero.c +index 3718f3cfd32e..192b2841413a 100644 +--- a/test/regression/2007-08-08-free-zero.c ++++ b/test/regression/2007-08-08-free-zero.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t1.bc + // RUN: ls %t.klee-out | not grep *.err +diff --git a/test/regression/2007-08-16-valid-write-to-freed-object.c b/test/regression/2007-08-16-valid-write-to-freed-object.c +index b32571009110..18dec41f8770 100644 +--- a/test/regression/2007-08-16-valid-write-to-freed-object.c ++++ b/test/regression/2007-08-16-valid-write-to-freed-object.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t1.bc + +diff --git a/test/regression/2007-10-11-free-of-alloca.c b/test/regression/2007-10-11-free-of-alloca.c +index cfd633dc954a..b6b38328ccac 100644 +--- a/test/regression/2007-10-11-free-of-alloca.c ++++ b/test/regression/2007-10-11-free-of-alloca.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -g -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck %s + // RUN: test -f %t.klee-out/test000001.free.err +diff --git a/test/regression/2007-10-12-failed-make-symbolic-after-copy.c b/test/regression/2007-10-12-failed-make-symbolic-after-copy.c +index 800b57e7446d..85cc7c5b8f38 100644 +--- a/test/regression/2007-10-12-failed-make-symbolic-after-copy.c ++++ b/test/regression/2007-10-12-failed-make-symbolic-after-copy.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t1.bc + // RUN: test -f %t.klee-out/test000001.ktest +diff --git a/test/regression/2008-03-04-free-of-global.c b/test/regression/2008-03-04-free-of-global.c +index 3416fd61f0ba..ac9cb7dec349 100644 +--- a/test/regression/2008-03-04-free-of-global.c ++++ b/test/regression/2008-03-04-free-of-global.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -g -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck %s + // RUN: test -f %t.klee-out/test000001.free.err +diff --git a/test/regression/2008-03-11-free-of-malloc-zero.c b/test/regression/2008-03-11-free-of-malloc-zero.c +index 07ec29182b59..6089df94c969 100644 +--- a/test/regression/2008-03-11-free-of-malloc-zero.c ++++ b/test/regression/2008-03-11-free-of-malloc-zero.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc + +diff --git a/test/regression/2008-04-10-bad-alloca-free.c b/test/regression/2008-04-10-bad-alloca-free.c +index 3404a42e54be..afff42103f7a 100644 +--- a/test/regression/2008-04-10-bad-alloca-free.c ++++ b/test/regression/2008-04-10-bad-alloca-free.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc + +diff --git a/test/regression/2008-05-23-gep-with-global-const.c b/test/regression/2008-05-23-gep-with-global-const.c +index 6bd78dd29131..e93692f95aa0 100644 +--- a/test/regression/2008-05-23-gep-with-global-const.c ++++ b/test/regression/2008-05-23-gep-with-global-const.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc -emit-llvm -O0 -c -o %t.bc %s ++// RUN: %llvmgcc -emit-llvm %O0opt -c -o %t.bc %s + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --exit-on-error %t.bc + +diff --git a/test/regression/2012-05-13-asm-causes-aborts.c b/test/regression/2012-05-13-asm-causes-aborts.c +index 322e5bb8746d..cc73f0b35583 100644 +--- a/test/regression/2012-05-13-asm-causes-aborts.c ++++ b/test/regression/2012-05-13-asm-causes-aborts.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t1.bc + +diff --git a/test/regression/2014-07-04-unflushed-error-report.c b/test/regression/2014-07-04-unflushed-error-report.c +index 0518fb4d4566..f9547c176df9 100644 +--- a/test/regression/2014-07-04-unflushed-error-report.c ++++ b/test/regression/2014-07-04-unflushed-error-report.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out -check-overshift %t.bc 2> %t.log + // RUN: FileCheck -input-file=%t.klee-out/test000001.overshift.err %s +diff --git a/test/regression/2014-09-13-debug-info.c b/test/regression/2014-09-13-debug-info.c +index e372e89e2cc6..ddf8461d179d 100644 +--- a/test/regression/2014-09-13-debug-info.c ++++ b/test/regression/2014-09-13-debug-info.c +@@ -1,6 +1,6 @@ + // Check that we properly detect states covering new instructions. + // +-// RUN: %llvmgcc -I../../../include %s -emit-llvm -O0 -c -o %t1.bc ++// RUN: %llvmgcc -I../../../include %s -emit-llvm %O0opt -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --only-output-states-covering-new %t1.bc + +diff --git a/test/regression/2014-12-08-ashr.c b/test/regression/2014-12-08-ashr.c +index 3fe7f62b42e6..be3507297b54 100644 +--- a/test/regression/2014-12-08-ashr.c ++++ b/test/regression/2014-12-08-ashr.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out -exit-on-error %t.bc + +diff --git a/test/regression/2015-06-22-struct-write.c b/test/regression/2015-06-22-struct-write.c +index 6efc4ee6df83..54bb5d1fcbaa 100644 +--- a/test/regression/2015-06-22-struct-write.c ++++ b/test/regression/2015-06-22-struct-write.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out -exit-on-error %t.bc + +diff --git a/test/regression/2015-08-05-invalid-fork.c b/test/regression/2015-08-05-invalid-fork.c +index 7c35872cfcd8..d089ed118cbc 100644 +--- a/test/regression/2015-08-05-invalid-fork.c ++++ b/test/regression/2015-08-05-invalid-fork.c +@@ -3,7 +3,7 @@ + is printed a single time. + */ + +-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t.bc | FileCheck %s + +diff --git a/test/regression/2015-08-30-empty-constraints.c b/test/regression/2015-08-30-empty-constraints.c +index b07beccd92d6..a75dd8a40f0d 100644 +--- a/test/regression/2015-08-30-empty-constraints.c ++++ b/test/regression/2015-08-30-empty-constraints.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t.bc 2> %t.log + // RUN: FileCheck -input-file=%t.log %s +diff --git a/test/regression/2015-08-30-sdiv-1.c b/test/regression/2015-08-30-sdiv-1.c +index a90df30880a8..6994dbdb0fd2 100644 +--- a/test/regression/2015-08-30-sdiv-1.c ++++ b/test/regression/2015-08-30-sdiv-1.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out -exit-on-error -solver-optimize-divides=true %t.bc + // RUN: rm -rf %t.klee-out +diff --git a/test/regression/2016-04-14-sdiv-2.c b/test/regression/2016-04-14-sdiv-2.c +index 974036ee100a..aab14c462bb5 100644 +--- a/test/regression/2016-04-14-sdiv-2.c ++++ b/test/regression/2016-04-14-sdiv-2.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out -exit-on-error -solver-optimize-divides=true %t.bc >%t1.log + // RUN: grep "m is 2" %t1.log +diff --git a/test/regression/2016-06-28-div-zero-bug.c b/test/regression/2016-06-28-div-zero-bug.c +index 76e70ad1e0f6..f2214039612b 100644 +--- a/test/regression/2016-06-28-div-zero-bug.c ++++ b/test/regression/2016-06-28-div-zero-bug.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --use-cex-cache=false %t.bc >%t1.log + +diff --git a/test/regression/2016-08-06-klee-get-obj-size.c b/test/regression/2016-08-06-klee-get-obj-size.c +index df4114ff33f7..3d3dc357150e 100644 +--- a/test/regression/2016-08-06-klee-get-obj-size.c ++++ b/test/regression/2016-08-06-klee-get-obj-size.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out %t.bc + // RUN: test -f %t.klee-out/test000001.assert.err +diff --git a/test/regression/2016-08-11-entry-point-internalize-pass.c b/test/regression/2016-08-11-entry-point-internalize-pass.c +index 4cd8ff8d2a0d..195806015a59 100644 +--- a/test/regression/2016-08-11-entry-point-internalize-pass.c ++++ b/test/regression/2016-08-11-entry-point-internalize-pass.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --entry-point=entry %t.bc + +diff --git a/test/regression/2016-08-12-empty-file.c b/test/regression/2016-08-12-empty-file.c +index b965027837f8..a4f1b19cb15d 100644 +--- a/test/regression/2016-08-12-empty-file.c ++++ b/test/regression/2016-08-12-empty-file.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: not %klee --output-dir=%t.klee-out %t.bc >%t1.log 2>&1 + // RUN: FileCheck -input-file=%t1.log -check-prefix=CHECK-MAIN-NOT-FOUND %s +diff --git a/test/regression/2016-11-24-bitcast-weak-alias.c b/test/regression/2016-11-24-bitcast-weak-alias.c +index b20e205ee750..d420ac5295e2 100644 +--- a/test/regression/2016-11-24-bitcast-weak-alias.c ++++ b/test/regression/2016-11-24-bitcast-weak-alias.c +@@ -1,5 +1,5 @@ + // REQUIRES: not-darwin +-// RUN: %llvmgcc %s -Wall -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -Wall -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out -exit-on-error -search=nurs:covnew %t.bc DUMMY_ARG >%t1.log 2>&1 + // RUN: FileCheck -input-file=%t1.log %s +diff --git a/test/regression/2016-12-14-alloc-alignment.c b/test/regression/2016-12-14-alloc-alignment.c +index db66d1911bcd..8c58d6f9a294 100644 +--- a/test/regression/2016-12-14-alloc-alignment.c ++++ b/test/regression/2016-12-14-alloc-alignment.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -Wall -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -Wall -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out --exit-on-error %t.bc + #include +diff --git a/test/regression/2017-02-21-pathOS-id.c b/test/regression/2017-02-21-pathOS-id.c +index d3bffbe04bf6..9be321de06b2 100644 +--- a/test/regression/2017-02-21-pathOS-id.c ++++ b/test/regression/2017-02-21-pathOS-id.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee --output-dir=%t.klee-out -write-paths %t.bc 2> %t.log + // RUN: cat %t.klee-out/test000001.path | wc -l | grep -q 1 +diff --git a/test/regression/2017-03-23-early-exit-log-stats.c b/test/regression/2017-03-23-early-exit-log-stats.c +index 96d3c30f23c6..d68bfa8f8c42 100644 +--- a/test/regression/2017-03-23-early-exit-log-stats.c ++++ b/test/regression/2017-03-23-early-exit-log-stats.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc ++// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc + // RUN: rm -rf %t.klee-out + // Delay writing instructions so that we ensure on exit that flush happens + // RUN: not %klee --output-dir=%t.klee-out -exit-on-error -stats-write-interval=0 -stats-write-after-instructions=999999 %t.bc 2> %t.log +diff --git a/test/regression/2018-05-05-number-instructions-dumped-states.c b/test/regression/2018-05-05-number-instructions-dumped-states.c +index 5f2af61e0d89..8d183b77a010 100644 +--- a/test/regression/2018-05-05-number-instructions-dumped-states.c ++++ b/test/regression/2018-05-05-number-instructions-dumped-states.c +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc + // RUN: rm -rf %t.klee-out + // RUN: %klee -stop-after-n-instructions=1 --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck %s + +-- +2.17.1 + diff --git a/0019-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch b/0028-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch similarity index 99% rename from 0019-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch rename to 0028-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch index 5440ffb..03eac0b 100644 --- a/0019-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch +++ b/0028-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch @@ -81,5 +81,5 @@ index d39249df023f..b7f2b6ff347a 100644 llvm::cl::PrintVersionMessage(); } -- -2.17.0 +2.17.1 diff --git a/0020-llvm60-handle-headers-renaming.patch b/0029-llvm60-handle-headers-renaming.patch similarity index 99% rename from 0020-llvm60-handle-headers-renaming.patch rename to 0029-llvm60-handle-headers-renaming.patch index 5aefa01..5806af9 100644 --- a/0020-llvm60-handle-headers-renaming.patch +++ b/0029-llvm60-handle-headers-renaming.patch @@ -33,5 +33,5 @@ index d9b3e40154ba..d478ff828796 100644 using namespace llvm; -- -2.17.0 +2.17.1 diff --git a/FileCheck.cpp b/FileCheck.cpp index 7cc71eb..f98d47c 100644 --- a/FileCheck.cpp +++ b/FileCheck.cpp @@ -10,7 +10,7 @@ // FileCheck does a line-by line check of a file that validates whether it // contains the expected content. This is useful for regression tests etc. // -// This program exits with an error status of 2 on error, exit status of 0 if +// This program exits with an exit status of 2 on error, exit status of 0 if // the file matched the expected contents, and exit status of 1 if it did not // contain the expected contents. // @@ -62,6 +62,10 @@ static cl::list ImplicitCheckNot( "this pattern occur which are not matched by a positive pattern"), cl::value_desc("pattern")); +static cl::list GlobalDefines("D", cl::Prefix, + cl::desc("Define a variable to be used in capture patterns."), + cl::value_desc("VAR=VALUE")); + static cl::opt AllowEmptyInput( "allow-empty", cl::init(false), cl::desc("Allow the input file to be empty. This is useful when making\n" @@ -73,6 +77,12 @@ static cl::opt MatchFullLines( "Allows leading and trailing whitespace if --strict-whitespace\n" "is not also passed.")); +static cl::opt EnableVarScope( + "enable-var-scope", cl::init(false), + cl::desc("Enables scope for regex variables. Variables with names that\n" + "do not start with '$' will be reset at the beginning of\n" + "each CHECK-LABEL block.")); + typedef cl::list::const_iterator prefix_iterator; //===----------------------------------------------------------------------===// @@ -263,15 +273,19 @@ bool Pattern::ParsePattern(StringRef PatternStr, StringRef Prefix, // is relaxed, more strict check is performed in \c EvaluateExpression. bool IsExpression = false; for (unsigned i = 0, e = Name.size(); i != e; ++i) { - if (i == 0 && Name[i] == '@') { - if (NameEnd != StringRef::npos) { - SM.PrintMessage(SMLoc::getFromPointer(Name.data()), - SourceMgr::DK_Error, - "invalid name in named regex definition"); - return true; + if (i == 0) { + if (Name[i] == '$') // Global vars start with '$' + continue; + if (Name[i] == '@') { + if (NameEnd != StringRef::npos) { + SM.PrintMessage(SMLoc::getFromPointer(Name.data()), + SourceMgr::DK_Error, + "invalid name in named regex definition"); + return true; + } + IsExpression = true; + continue; } - IsExpression = true; - continue; } if (Name[i] != '_' && !isalnum(Name[i]) && (!IsExpression || (Name[i] != '+' && Name[i] != '-'))) { @@ -1193,7 +1207,7 @@ size_t CheckString::CheckDag(const SourceMgr &SM, StringRef Buffer, // If there's CHECK-NOTs between two CHECK-DAGs or from CHECK to // CHECK-DAG, verify that there's no 'not' strings occurred in that // region. - StringRef SkippedRegion = Buffer.substr(LastPos, MatchPos); + StringRef SkippedRegion = Buffer.slice(LastPos, MatchPos); if (CheckNot(SM, SkippedRegion, NotStrings, VariableTable)) return StringRef::npos; // Clear "not strings". @@ -1262,6 +1276,18 @@ static void DumpCommandLine(int argc, char **argv) { errs() << "\n"; } +// Remove local variables from \p VariableTable. Global variables +// (start with '$') are preserved. +static void ClearLocalVars(StringMap &VariableTable) { + SmallVector LocalVars; + for (const auto &Var : VariableTable) + if (Var.first()[0] != '$') + LocalVars.push_back(Var.first()); + + for (const auto &Var : LocalVars) + VariableTable.erase(Var); +} + /// Check the input to FileCheck provided in the \p Buffer against the \p /// CheckStrings read from the check file. /// @@ -1273,6 +1299,9 @@ bool CheckInput(SourceMgr &SM, StringRef Buffer, /// VariableTable - This holds all the current filecheck variables. StringMap VariableTable; + for (const auto& Def : GlobalDefines) + VariableTable.insert(StringRef(Def).split('=')); + unsigned i = 0, j = 0, e = CheckStrings.size(); while (true) { StringRef CheckRegion; @@ -1298,6 +1327,9 @@ bool CheckInput(SourceMgr &SM, StringRef Buffer, ++j; } + if (EnableVarScope) + ClearLocalVars(VariableTable); + for (; i != j; ++i) { const CheckString &CheckStr = CheckStrings[i]; diff --git a/klee-skip-some-tests.patch b/klee-skip-some-tests.patch deleted file mode 100644 index 695b78e..0000000 --- a/klee-skip-some-tests.patch +++ /dev/null @@ -1,21 +0,0 @@ -From: Jiri Slaby -Date: Thu, 15 Jun 2017 15:20:49 +0200 -Subject: klee: skip some tests -Patch-mainline: no - -Some of the tests trigger FAILURE occasionally. The reason is unknown -yet. So mark them as to require an unknown prerequisite to disable the -tests completely. - -Signed-off-by: Jiri Slaby ---- - test/Concrete/ConstantExpr.llvm37.ll | 1 + - 1 file changed, 1 insertion(+) - ---- a/test/Concrete/ConstantExpr.llvm37.ll -+++ b/test/Concrete/ConstantExpr.llvm37.ll -@@ -1,3 +1,4 @@ -+; REQUIRES: bubak - ; REQUIRES: geq-llvm-3.7 - ; RUN: %S/ConcreteTest.py --klee='%klee' --lli=%lli %s - diff --git a/klee.changes b/klee.changes index c074408..c063469 100644 --- a/klee.changes +++ b/klee.changes @@ -7,6 +7,59 @@ Sat Jun 16 09:09:56 UTC 2018 - opensuse-packaging@opensuse.org * cmake: find_llvm, handle libLLVM-version.so properly * Fixed memory leak from Executor::inCloseMerge, fixes #883 - Require python3-lit as the lit packaging was refactored +- switch to llvm 6 +- removed patches (it was split into multiple commits below): + * 0001-llvm-make-KLEE-compile-against-LLVM-3.8.patch +- added patches: + * 0001-test-remove-undefined-behaviour.patch + * 0002-llvm38-no-rounding-in-APFloat.patch + * 0003-llvm38-handle-optimization-passes-changes.patch + * 0004-llvm38-SmallString-is-always-up-to-date.patch + * 0005-llvm38-materializeAllPermanently-was-renamed.patch + * 0006-llvm38-adapt-to-new-Linker-linkModules.patch + * 0007-llvm38-archive-child-iterator-changes.patch + * 0008-llvm38-no-more-implicit-iterators.patch + * 0011-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch + * 0027-llvm50-test-add-disable-O0-optnone-to-O0.patch +- renamed patches: + * 0002-llvm38-test-change-some-tests.patch + -> 0009-llvm38-test-change-some-tests.patch + * 0003-llvm-make-KLEE-compile-against-LLVM-3.9.patch + -> 0010-llvm-make-KLEE-compile-against-LLVM-3.9.patch + * 0004-llvm40-handle-different-header-names.patch + -> 0012-llvm40-handle-different-header-names.patch + * 0005-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch + -> 0013-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch + * 0006-llvm40-errorOr-and-similar.patch + -> 0014-llvm40-errorOr-and-similar.patch + * 0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch + -> 0015-llvm-use-chrono-helpers-from-LLVM-4.0.patch + * 0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch + -> 0016-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch + * 0009-llvm40-gep_type_iterator-has-no-operator.patch + -> 0017-llvm40-gep_type_iterator-has-no-operator.patch + * 0010-llvm50-avoid-on-function-arg_begin.patch + -> 0018-llvm50-avoid-on-function-arg_begin.patch + * 0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch + -> 0019-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch + * 0012-llvm50-handle-getOrInsertFunction-terminator.patch + -> 0020-llvm50-handle-getOrInsertFunction-terminator.patch + * 0013-llvm50-SwitchInst-case-functions-now-return-pointers.patch + -> 0021-llvm50-SwitchInst-case-functions-now-return-pointers.patch + * 0014-llvm50-handle-new-file_magic-s-location.patch + -> 0022-llvm50-handle-new-file_magic-s-location.patch + * 0015-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch + -> 0023-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch + * 0016-llvm50-AllocaInst-takes-address-space.patch + -> 0024-llvm50-AllocaInst-takes-address-space.patch + * 0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch + -> 0025-llvm50-Intrinsic-objectsize-has-three-arguments.patch + * 0018-llvm50-test-change-objectsize.patch + -> 0026-llvm50-test-change-objectsize.patch + * 0019-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch + -> 0028-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch + * 0020-llvm60-handle-headers-renaming.patch + -> 0029-llvm60-handle-headers-renaming.patch ------------------------------------------------------------------- Fri May 25 10:57:57 UTC 2018 - opensuse-packaging@opensuse.org diff --git a/klee.spec b/klee.spec index 7de4abf..2215608 100644 --- a/klee.spec +++ b/klee.spec @@ -15,7 +15,7 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # -%define llvm_version_major 4 +%define llvm_version_major 6 %define llvm_version_minor 0 %define llvm_version %{llvm_version_major} @@ -39,28 +39,35 @@ 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 -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 +Patch201: 0001-test-remove-undefined-behaviour.patch +Patch202: 0002-llvm38-no-rounding-in-APFloat.patch +Patch203: 0003-llvm38-handle-optimization-passes-changes.patch +Patch204: 0004-llvm38-SmallString-is-always-up-to-date.patch +Patch205: 0005-llvm38-materializeAllPermanently-was-renamed.patch +Patch206: 0006-llvm38-adapt-to-new-Linker-linkModules.patch +Patch207: 0007-llvm38-archive-child-iterator-changes.patch +Patch208: 0008-llvm38-no-more-implicit-iterators.patch +Patch209: 0009-llvm38-test-change-some-tests.patch +Patch210: 0010-llvm-make-KLEE-compile-against-LLVM-3.9.patch +Patch211: 0011-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch +Patch212: 0012-llvm40-handle-different-header-names.patch +Patch213: 0013-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch +Patch214: 0014-llvm40-errorOr-and-similar.patch +Patch215: 0015-llvm-use-chrono-helpers-from-LLVM-4.0.patch +Patch216: 0016-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch +Patch217: 0017-llvm40-gep_type_iterator-has-no-operator.patch +Patch218: 0018-llvm50-avoid-on-function-arg_begin.patch +Patch219: 0019-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch +Patch220: 0020-llvm50-handle-getOrInsertFunction-terminator.patch +Patch221: 0021-llvm50-SwitchInst-case-functions-now-return-pointers.patch +Patch222: 0022-llvm50-handle-new-file_magic-s-location.patch +Patch223: 0023-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch +Patch224: 0024-llvm50-AllocaInst-takes-address-space.patch +Patch225: 0025-llvm50-Intrinsic-objectsize-has-three-arguments.patch +Patch226: 0026-llvm50-test-change-objectsize.patch +Patch227: 0027-llvm50-test-add-disable-O0-optnone-to-O0.patch +Patch228: 0028-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch +Patch229: 0029-llvm60-handle-headers-renaming.patch BuildRequires: clang%{llvm_version} BuildRequires: cmake @@ -108,8 +115,15 @@ information on what KLEE is and what it can do, see the OSDI 2008 paper. %patch218 -p1 %patch219 -p1 %patch220 -p1 - -#%%patch300 -p1 +%patch221 -p1 +%patch222 -p1 +%patch223 -p1 +%patch224 -p1 +%patch225 -p1 +%patch226 -p1 +%patch227 -p1 +%patch228 -p1 +%patch229 -p1 mkdir -p build/test/ cp %{SOURCE2} build/test/ diff --git a/not.cpp b/not.cpp index 5fa5486..1321e94 100644 --- a/not.cpp +++ b/not.cpp @@ -39,8 +39,7 @@ int main(int argc, const char **argv) { } std::string ErrMsg; - int Result = sys::ExecuteAndWait(*Program, argv, nullptr, nullptr, 0, 0, - &ErrMsg); + int Result = sys::ExecuteAndWait(*Program, argv, nullptr, {}, 0, 0, &ErrMsg); #ifdef _WIN32 // Handle abort() in msvcrt -- It has exit code as 3. abort(), aka // unreachable, should be recognized as a crash. However, some binaries use From 6bf8f5f89e663c9aba99e5839c620db699aa9dcd57a83c32bdc5cd18897b764c Mon Sep 17 00:00:00 2001 From: OBS User buildservice-autocommit Date: Tue, 19 Jun 2018 10:03:33 +0000 Subject: [PATCH 2/5] Updating link to change in openSUSE:Factory/klee revision 10.0 OBS-URL: https://build.opensuse.org/package/show/devel:tools:statica/klee?expand=0&rev=3b5e3c45140d45252f47b54206fa708e --- klee.changes | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/klee.changes b/klee.changes index c063469..94ae958 100644 --- a/klee.changes +++ b/klee.changes @@ -1,6 +1,16 @@ ------------------------------------------------------------------- Sat Jun 16 09:09:56 UTC 2018 - opensuse-packaging@opensuse.org +- Update to version 1.4.0+20180614: + * Add unittest for DiscretePDF + * klee_int: allow NULL as name + * cmake: find_llvm, handle libLLVM-version.so properly + * Fixed memory leak from Executor::inCloseMerge, fixes #883 +- Require python3-lit as the lit packaging was refactored + +------------------------------------------------------------------- +Sat Jun 16 09:09:56 UTC 2018 - opensuse-packaging@opensuse.org + - Update to version 1.4.0+20180614: * Add unittest for DiscretePDF * klee_int: allow NULL as name From 13e4a995d1e8613a6eb7aa50b9cc215d073f3ce0a22939cdee829b05d0ed2612 Mon Sep 17 00:00:00 2001 From: OBS User buildservice-autocommit Date: Tue, 19 Jun 2018 10:03:33 +0000 Subject: [PATCH 3/5] Accepting request 617208 from devel:tools:statica baserev update by copy to link target OBS-URL: https://build.opensuse.org/request/show/617208 OBS-URL: https://build.opensuse.org/package/show/devel:tools:statica/klee?expand=0&rev=52 --- klee.changes | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/klee.changes b/klee.changes index 94ae958..c063469 100644 --- a/klee.changes +++ b/klee.changes @@ -1,16 +1,6 @@ ------------------------------------------------------------------- Sat Jun 16 09:09:56 UTC 2018 - opensuse-packaging@opensuse.org -- Update to version 1.4.0+20180614: - * Add unittest for DiscretePDF - * klee_int: allow NULL as name - * cmake: find_llvm, handle libLLVM-version.so properly - * Fixed memory leak from Executor::inCloseMerge, fixes #883 -- Require python3-lit as the lit packaging was refactored - -------------------------------------------------------------------- -Sat Jun 16 09:09:56 UTC 2018 - opensuse-packaging@opensuse.org - - Update to version 1.4.0+20180614: * Add unittest for DiscretePDF * klee_int: allow NULL as name From 2a206728e255f639532f42d2c139450d4e4ff2eb12e7cc7214c730a9a9592485 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Sun, 2 Sep 2018 08:39:13 +0000 Subject: [PATCH 4/5] add klee-skip-some-tests.patch to changes OBS-URL: https://build.opensuse.org/package/show/devel:tools:statica/klee?expand=0&rev=53 --- klee.changes | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/klee.changes b/klee.changes index c063469..a92c0ed 100644 --- a/klee.changes +++ b/klee.changes @@ -8,8 +8,11 @@ Sat Jun 16 09:09:56 UTC 2018 - opensuse-packaging@opensuse.org * Fixed memory leak from Executor::inCloseMerge, fixes #883 - Require python3-lit as the lit packaging was refactored - switch to llvm 6 -- removed patches (it was split into multiple commits below): +- removed patches: * 0001-llvm-make-KLEE-compile-against-LLVM-3.8.patch + (it was split into multiple commits below) + * klee-skip-some-tests.patch + (tests should be working perfectly now) - added patches: * 0001-test-remove-undefined-behaviour.patch * 0002-llvm38-no-rounding-in-APFloat.patch From 51b6157cc67e7855e042feedf1ef79b2fdba2ca4636979b73666990bc29ef091 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Sun, 2 Sep 2018 08:58:44 +0000 Subject: [PATCH 5/5] up to 1.4.0+20180829 OBS-URL: https://build.opensuse.org/package/show/devel:tools:statica/klee?expand=0&rev=54 --- ...m-make-KLEE-compile-against-LLVM-3.9.patch | 165 ++++---- 0001-test-remove-undefined-behaviour.patch | 71 ---- ...m-fix-libraries-with-llvm-config-3.9.patch | 2 +- 0002-llvm38-no-rounding-in-APFloat.patch | 34 -- ...8-handle-optimization-passes-changes.patch | 62 --- ...EE_RUNTIME_BUILD_TYPE-to-Debug-Asser.patch | 33 ++ ...m38-SmallString-is-always-up-to-date.patch | 33 -- ...llvm40-handle-different-header-names.patch | 42 +- ...at-members-are-functions-in-LLVM-4.0.patch | 6 +- ...aterializeAllPermanently-was-renamed.patch | 31 -- ...vm38-adapt-to-new-Linker-linkModules.patch | 72 ---- 0006-llvm40-errorOr-and-similar.patch | 53 +++ ...lvm-use-chrono-helpers-from-LLVM-4.0.patch | 8 +- ...lvm38-archive-child-iterator-changes.patch | 61 --- ...Type-is-not-SequentialType-in-LLVM-4.patch | 8 +- 0008-llvm38-no-more-implicit-iterators.patch | 78 ---- 0009-llvm38-test-change-some-tests.patch | 155 -------- ...40-gep_type_iterator-has-no-operator.patch | 2 +- ...0-llvm50-avoid-on-function-arg_begin.patch | 12 +- ...erPartWidth-is-from-llvm-APFloatBase.patch | 6 +- ...andle-getOrInsertFunction-terminator.patch | 49 +-- ...t-case-functions-now-return-pointers.patch | 6 +- 0014-llvm40-errorOr-and-similar.patch | 128 ------ ...m50-handle-new-file_magic-s-location.patch | 36 +- ...leArrayRef-for-APFloat-convertToInte.patch | 8 +- ...lvm50-AllocaInst-takes-address-space.patch | 6 +- ...insic-objectsize-has-three-arguments.patch | 6 +- ...> 0018-llvm50-test-change-objectsize.patch | 2 +- ...50-test-add-disable-O0-optnone-to-O0.patch | 365 ++++++++++-------- ...lSite.paramHasAttr-is-indexed-from-0.patch | 46 +++ ...sionPrinter-now-passes-down-a-stream.patch | 4 +- ...> 0022-llvm6-handle-headers-renaming.patch | 6 +- _servicedata | 2 +- klee-1.4.0+20180614.tar.xz | 3 - klee-1.4.0+20180829.tar.xz | 3 + klee.changes | 106 +++++ klee.spec | 91 ++--- 37 files changed, 639 insertions(+), 1162 deletions(-) rename 0010-llvm-make-KLEE-compile-against-LLVM-3.9.patch => 0001-llvm-make-KLEE-compile-against-LLVM-3.9.patch (73%) delete mode 100644 0001-test-remove-undefined-behaviour.patch rename 0011-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch => 0002-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch (99%) delete mode 100644 0002-llvm38-no-rounding-in-APFloat.patch delete mode 100644 0003-llvm38-handle-optimization-passes-changes.patch create mode 100644 0003-llvm39-switch-KLEE_RUNTIME_BUILD_TYPE-to-Debug-Asser.patch delete mode 100644 0004-llvm38-SmallString-is-always-up-to-date.patch rename 0012-llvm40-handle-different-header-names.patch => 0004-llvm40-handle-different-header-names.patch (76%) rename 0013-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch => 0005-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch (89%) delete mode 100644 0005-llvm38-materializeAllPermanently-was-renamed.patch delete mode 100644 0006-llvm38-adapt-to-new-Linker-linkModules.patch create mode 100644 0006-llvm40-errorOr-and-similar.patch rename 0015-llvm-use-chrono-helpers-from-LLVM-4.0.patch => 0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch (97%) delete mode 100644 0007-llvm38-archive-child-iterator-changes.patch rename 0016-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch => 0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch (94%) delete mode 100644 0008-llvm38-no-more-implicit-iterators.patch delete mode 100644 0009-llvm38-test-change-some-tests.patch rename 0017-llvm40-gep_type_iterator-has-no-operator.patch => 0009-llvm40-gep_type_iterator-has-no-operator.patch (99%) rename 0018-llvm50-avoid-on-function-arg_begin.patch => 0010-llvm50-avoid-on-function-arg_begin.patch (81%) rename 0019-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch => 0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch (89%) rename 0020-llvm50-handle-getOrInsertFunction-terminator.patch => 0012-llvm50-handle-getOrInsertFunction-terminator.patch (61%) rename 0021-llvm50-SwitchInst-case-functions-now-return-pointers.patch => 0013-llvm50-SwitchInst-case-functions-now-return-pointers.patch (92%) delete mode 100644 0014-llvm40-errorOr-and-similar.patch rename 0022-llvm50-handle-new-file_magic-s-location.patch => 0014-llvm50-handle-new-file_magic-s-location.patch (67%) rename 0023-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch => 0015-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch (90%) rename 0024-llvm50-AllocaInst-takes-address-space.patch => 0016-llvm50-AllocaInst-takes-address-space.patch (91%) rename 0025-llvm50-Intrinsic-objectsize-has-three-arguments.patch => 0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch (94%) rename 0026-llvm50-test-change-objectsize.patch => 0018-llvm50-test-change-objectsize.patch (99%) rename 0027-llvm50-test-add-disable-O0-optnone-to-O0.patch => 0019-llvm50-test-add-disable-O0-optnone-to-O0.patch (85%) create mode 100644 0020-llvm50-CallSite.paramHasAttr-is-indexed-from-0.patch rename 0028-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch => 0021-llvm6-SetVersionPrinter-now-passes-down-a-stream.patch (97%) rename 0029-llvm60-handle-headers-renaming.patch => 0022-llvm6-handle-headers-renaming.patch (92%) delete mode 100644 klee-1.4.0+20180614.tar.xz create mode 100644 klee-1.4.0+20180829.tar.xz diff --git a/0010-llvm-make-KLEE-compile-against-LLVM-3.9.patch b/0001-llvm-make-KLEE-compile-against-LLVM-3.9.patch similarity index 73% rename from 0010-llvm-make-KLEE-compile-against-LLVM-3.9.patch rename to 0001-llvm-make-KLEE-compile-against-LLVM-3.9.patch index f3db496..be7d5e9 100644 --- a/0010-llvm-make-KLEE-compile-against-LLVM-3.9.patch +++ b/0001-llvm-make-KLEE-compile-against-LLVM-3.9.patch @@ -7,18 +7,18 @@ Signed-off-by: Jiri Slaby --- lib/Core/Executor.cpp | 16 ++++++++++++++++ lib/Core/MemoryManager.cpp | 5 ++++- - lib/Module/ModuleUtil.cpp | 36 +++++++++++++++++++++++++++++++++--- - lib/Module/Optimize.cpp | 28 ++++++++++++++++++++++++++++ + lib/Module/ModuleUtil.cpp | 33 ++++++++++++++++++++++++++++++--- + lib/Module/Optimize.cpp | 34 ++++++++++++++++++++++++++++++++++ lib/Module/RaiseAsm.cpp | 10 +++++++++- tools/kleaver/main.cpp | 4 ++++ tools/klee/main.cpp | 4 ++++ - 7 files changed, 98 insertions(+), 5 deletions(-) + 7 files changed, 101 insertions(+), 5 deletions(-) diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index b846947e5455..385920627641 100644 +index b053d4882431..7f69a618b8ec 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp -@@ -1305,10 +1305,18 @@ void Executor::executeCall(ExecutionState &state, +@@ -1338,10 +1338,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 b846947e5455..385920627641 100644 } } -@@ -1341,10 +1349,18 @@ void Executor::executeCall(ExecutionState &state, +@@ -1374,10 +1382,18 @@ void Executor::executeCall(ExecutionState &state, Expr::Width argWidth = arguments[i]->getWidth(); if (argWidth > Expr::Int64) { @@ -75,70 +75,10 @@ index 24e2ed97581f..f40e8bc9deb8 100644 // Handle the case of 0-sized allocations as 1-byte allocations. // This way, we make sure we have this allocation between its own red zones diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp -index e6d592b135b6..ee4af254dae2 100644 +index 5ca0a55b12d2..0e87b5a6deca 100644 --- a/lib/Module/ModuleUtil.cpp +++ b/lib/Module/ModuleUtil.cpp -@@ -196,7 +196,11 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er - - KLEE_DEBUG_WITH_TYPE("klee_linker", dbgs() << "Loading modules\n"); - // Load all bitcode files in to memory so we can examine their symbols --#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+ Error Err; -+ for (object::Archive::child_iterator AI = archive->child_begin(Err), -+ AE = archive->child_end(); AI != AE; ++AI) -+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) - for (object::Archive::child_iterator AI = archive->child_begin(), - AE = archive->child_end(); AI != AE; ++AI) - #else -@@ -236,7 +240,17 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er - return false; - } - --#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+ Expected > child = -+ childErr->getAsBinary(); -+ if (!child) { -+ // I don't know why, but -+ // ec = errorToErrorCode(child.takeError()) -+ // does not work here, so: -+ consumeError(child.takeError()); -+ ec = std::make_error_code(std::errc::io_error); -+ } -+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) - ErrorOr > child = - childErr->getAsBinary(); - ec = child.getError(); -@@ -319,6 +333,13 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er - } - - } -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+ if (Err) { -+ SS << "Cannot iterate over archive"; -+ SS.flush(); -+ return false; -+ } -+#endif - - KLEE_DEBUG_WITH_TYPE("klee_linker", dbgs() << "Loaded " << archiveModules.size() << " modules\n"); - -@@ -490,7 +511,12 @@ Module *klee::linkWithLibrary(Module *module, - #endif - - } else if (magic == sys::fs::file_magic::archive) { --#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+ Expected > arch = -+ object::createBinary(Buffer, &Context); -+ if (!arch) -+ ec = errorToErrorCode(arch.takeError()); -+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) - ErrorOr > arch = - object::createBinary(Buffer, &Context); - ec = arch.getError(); -@@ -548,7 +574,11 @@ Function *klee::getDirectCallTarget(CallSite cs, bool moduleIsFullyLinked) { +@@ -284,7 +284,11 @@ Function *klee::getDirectCallTarget(CallSite cs, bool moduleIsFullyLinked) { if (Function *f = dyn_cast(v)) { return f; } else if (llvm::GlobalAlias *ga = dyn_cast(v)) { @@ -150,8 +90,66 @@ index e6d592b135b6..ee4af254dae2 100644 v = ga->getAliasee(); } else { v = NULL; +@@ -393,7 +397,13 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context, + } + + if (magic == sys::fs::file_magic::archive) { +-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) ++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) ++ Expected > archOwner = ++ object::createBinary(Buffer, &context); ++ if (!archOwner) ++ ec = errorToErrorCode(archOwner.takeError()); ++ llvm::object::Binary *arch = archOwner.get().get(); ++#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) + ErrorOr> archOwner = + object::createBinary(Buffer, &context); + ec = archOwner.getError(); +@@ -414,7 +424,12 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context, + + if (auto archive = dyn_cast(arch)) { + // Load all bitcode files into memory +-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) ++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) ++ Error Err; ++ for (object::Archive::child_iterator AI = archive->child_begin(Err), ++ AE = archive->child_end(); ++ AI != AE; ++AI) ++#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) + for (object::Archive::child_iterator AI = archive->child_begin(), + AE = archive->child_end(); + AI != AE; ++AI) +@@ -455,7 +470,12 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context, + return false; + } + +-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) ++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) ++ Expected > child = ++ childOrErr->getAsBinary(); ++ if (!child) ++ ec = errorToErrorCode(child.takeError()); ++#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) + ErrorOr> child = + childOrErr->getAsBinary(); + ec = child.getError(); +@@ -519,7 +539,14 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context, + return false; + } + } ++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) ++ if (Err) { ++ errorMsg = "Cannot iterate over archive"; ++ return false; ++ } ++#endif + } ++ + return true; + } + if (magic.is_object()) { diff --git a/lib/Module/Optimize.cpp b/lib/Module/Optimize.cpp -index df7b147d0abe..8239c3a24c12 100644 +index c788ee36cadb..34af46262080 100644 --- a/lib/Module/Optimize.cpp +++ b/lib/Module/Optimize.cpp @@ -39,6 +39,11 @@ @@ -190,23 +188,28 @@ index df7b147d0abe..8239c3a24c12 100644 addPass(PM, createInstructionCombiningPass()); // Combine silly seq's addPass(PM, createTailCallEliminationPass()); // Eliminate tail calls -@@ -183,8 +196,15 @@ void Optimize(Module *M, const std::string &EntryPoint) { +@@ -183,7 +196,20 @@ void Optimize(Module *M, llvm::ArrayRef preservedFunctions) { // for a main function. If main is defined, mark all other functions // internal. if (!DisableInternalize) { +#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+ auto PreserveEP = [=](const GlobalValue &GV) { -+ return GV.getName().equals(EntryPoint); ++ auto PreserveFunctions = [=](const GlobalValue &GV) { ++ StringRef GVName = GV.getName(); ++ ++ for (const char *fun: preservedFunctions) ++ if (GVName.equals(fun)) ++ return true; ++ ++ return false; + }; -+ ModulePass *pass = createInternalizePass(PreserveEP); ++ ModulePass *pass = createInternalizePass(PreserveFunctions); +#else - ModulePass *pass = createInternalizePass( - std::vector(1, EntryPoint.c_str())); + ModulePass *pass = createInternalizePass(preservedFunctions); +#endif addPass(Passes, pass); } -@@ -223,11 +243,19 @@ void Optimize(Module *M, const std::string &EntryPoint) { +@@ -222,11 +248,19 @@ void Optimize(Module *M, llvm::ArrayRef preservedFunctions) { // The IPO passes may leave cruft around. Clean up after them. addPass(Passes, createInstructionCombiningPass()); addPass(Passes, createJumpThreadingPass()); // Thread jumps. @@ -227,7 +230,7 @@ index df7b147d0abe..8239c3a24c12 100644 addPass(Passes, createGlobalsAAWrapperPass()); // IP alias analysis #else diff --git a/lib/Module/RaiseAsm.cpp b/lib/Module/RaiseAsm.cpp -index c597fa2a7b82..d9b3e40154ba 100644 +index c597fa2a7b82..4967a2fa8578 100644 --- a/lib/Module/RaiseAsm.cpp +++ b/lib/Module/RaiseAsm.cpp @@ -60,7 +60,11 @@ bool RaiseAsmPass::runOnInstruction(Module &M, Instruction *I) { @@ -249,7 +252,7 @@ index c597fa2a7b82..d9b3e40154ba 100644 -#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) +#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) + TM = NativeTarget->createTargetMachine(HostTriple, "", "", TargetOptions(), -+ None); ++ None); + TLI = TM->getSubtargetImpl(*(M.begin()))->getTargetLowering(); +#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) TM = NativeTarget->createTargetMachine(HostTriple, "", "", TargetOptions()); @@ -272,10 +275,10 @@ index b8b32e31264a..800cece95e9c 100644 llvm::cl::ParseCommandLineOptions(argc, argv); diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp -index 3d73ae07fcb5..c0ea4fa54551 100644 +index c655aa560f62..7be5f07cdc0e 100644 --- a/tools/klee/main.cpp +++ b/tools/klee/main.cpp -@@ -1132,7 +1132,11 @@ int main(int argc, char **argv, char **envp) { +@@ -1092,7 +1092,11 @@ int main(int argc, char **argv, char **envp) { llvm::InitializeNativeTarget(); parseArguments(argc, argv); @@ -288,5 +291,5 @@ index 3d73ae07fcb5..c0ea4fa54551 100644 if (Watchdog) { if (MaxTime==0) { -- -2.17.1 +2.18.0 diff --git a/0001-test-remove-undefined-behaviour.patch b/0001-test-remove-undefined-behaviour.patch deleted file mode 100644 index a9287f0..0000000 --- a/0001-test-remove-undefined-behaviour.patch +++ /dev/null @@ -1,71 +0,0 @@ -From: Jiri Slaby -Date: Fri, 15 Jun 2018 10:32:26 +0200 -Subject: test: remove undefined behaviour -Patch-mainline: no - -Shifting negative values is implementation-defined. - -Shifting by equal number of the bits as is the size of the type is -undefined. - -So fix both of these. - -This fixes #911. - -Signed-off-by: Jiri Slaby ---- - .../Feature/arithmetic-right-overshift-sym-conc.c | 15 +++++++++------ - 1 file changed, 9 insertions(+), 6 deletions(-) - -diff --git a/test/Feature/arithmetic-right-overshift-sym-conc.c b/test/Feature/arithmetic-right-overshift-sym-conc.c -index 7af6f9d7f08f..63b93db32ed9 100644 ---- a/test/Feature/arithmetic-right-overshift-sym-conc.c -+++ b/test/Feature/arithmetic-right-overshift-sym-conc.c -@@ -13,14 +13,17 @@ typedef enum - UNKNOWN - } overshift_t; - -+#define INT_31_BITS (0xffffffff >> 1) -+ - // We're using signed ints so should be doing - // arithmetic right shift. - // lhs should be a constant --int overshift(signed int lhs, volatile unsigned int y, const char * type) -+unsigned int overshift(unsigned int lhs, volatile unsigned int y, -+ const char *type) - { - overshift_t ret; -- volatile signed int x = lhs; -- unsigned int limit = sizeof(x)*8; -+ volatile unsigned int x = lhs; -+ unsigned int limit = sizeof(x)*8 - 1; - assert(!klee_is_symbolic(x)); - - volatile signed int result; -@@ -47,12 +50,12 @@ int overshift(signed int lhs, volatile unsigned int y, const char * type) - - int main(int argc, char** argv) - { -- volatile unsigned int y = sizeof(unsigned int)*8; -+ volatile unsigned int y = sizeof(unsigned int)*8 - 1; - // Try with +ve lhs - overshift_t conc = overshift(15, y, "Concrete"); - assert(conc == TO_ZERO); - // Try with -ve lhs -- conc = overshift(-1, y, "Concrete"); -+ conc = overshift(INT_31_BITS, y, "Concrete"); - assert(conc == TO_ZERO); - - // Symbolic overshift -@@ -65,7 +68,7 @@ int main(int argc, char** argv) - overshift_t sym = overshift(15, y2, "Symbolic"); - assert(sym == TO_ZERO); - // Try with -ve lhs -- sym = overshift(-1, y2, "Symbolic"); -+ sym = overshift(INT_31_BITS, y2, "Symbolic"); - assert(sym == TO_ZERO); - - // Concrete and symbolic behaviour should be the same --- -2.17.1 - diff --git a/0011-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch b/0002-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch similarity index 99% rename from 0011-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch rename to 0002-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch index 86d8f6e..b603cd0 100644 --- a/0011-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch +++ b/0002-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch @@ -34,5 +34,5 @@ index adf68c4fc82a..8ceed19f7b9e 100644 list(APPEND targets_to_return "${target_name}") if (NOT TARGET "${target_name}") -- -2.17.1 +2.18.0 diff --git a/0002-llvm38-no-rounding-in-APFloat.patch b/0002-llvm38-no-rounding-in-APFloat.patch deleted file mode 100644 index cd135be..0000000 --- a/0002-llvm38-no-rounding-in-APFloat.patch +++ /dev/null @@ -1,34 +0,0 @@ -From: Jiri Slaby -Date: Fri, 15 Jun 2018 07:51:10 +0200 -Subject: llvm38: no rounding in APFloat -Patch-mainline: no - -The rounding was removed because it was never needed: -llvm-mirror/llvm@ff278be - -Signed-off-by: Jiri Slaby ---- - lib/Core/Executor.cpp | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index 24fcea8811c4..b846947e5455 100644 ---- a/lib/Core/Executor.cpp -+++ b/lib/Core/Executor.cpp -@@ -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()); -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ Res.mod( -+ APFloat(*fpWidthToSemantics(right->getWidth()), right->getAPValue())); -+#else - Res.mod(APFloat(*fpWidthToSemantics(right->getWidth()),right->getAPValue()), - APFloat::rmNearestTiesToEven); -+#endif - bindLocal(ki, state, ConstantExpr::alloc(Res.bitcastToAPInt())); - break; - } --- -2.17.1 - diff --git a/0003-llvm38-handle-optimization-passes-changes.patch b/0003-llvm38-handle-optimization-passes-changes.patch deleted file mode 100644 index ffd2b0f..0000000 --- a/0003-llvm38-handle-optimization-passes-changes.patch +++ /dev/null @@ -1,62 +0,0 @@ -From: Jiri Slaby -Date: Fri, 15 Jun 2018 07:57:23 +0200 -Subject: llvm38: handle optimization passes changes -Patch-mainline: no - -createFunctionAttrsPass was split to createPostOrderFunctionAttrsPass -and createReversePostOrderFunctionAttrsPass in LLVM commit e96fb9ab15d4. - -createGlobalsModRefPass was changed to createGlobalsAAWrapperPass in -LLVM commit 9146833fa313. - -Signed-off-by: Jiri Slaby ---- - lib/Module/Optimize.cpp | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -diff --git a/lib/Module/Optimize.cpp b/lib/Module/Optimize.cpp -index 64e4863f70b3..df7b147d0abe 100644 ---- a/lib/Module/Optimize.cpp -+++ b/lib/Module/Optimize.cpp -@@ -35,6 +35,10 @@ - #include "llvm/Analysis/Verifier.h" - #endif - -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+#include "llvm/Analysis/GlobalsModRef.h" -+#endif -+ - using namespace llvm; - - // Don't verify at the end -@@ -102,7 +106,12 @@ static void AddStandardCompilePasses(klee::LegacyLLVMPassManagerTy &PM) { - addPass(PM, createCFGSimplificationPass()); // Clean up after IPCP & DAE - - addPass(PM, createPruneEHPass()); // Remove dead EH info -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ addPass(PM, createPostOrderFunctionAttrsPass()); -+ addPass(PM, createReversePostOrderFunctionAttrsPass()); // Deduce function attrs -+#else - addPass(PM, createFunctionAttrsPass()); // Deduce function attrs -+#endif - - if (!DisableInline) - addPass(PM, createFunctionInliningPass()); // Inline small functions -@@ -217,8 +226,14 @@ void Optimize(Module *M, const std::string &EntryPoint) { - addPass(Passes, createScalarReplAggregatesPass()); // Break up allocas - - // Run a few AA driven optimizations here and now, to cleanup the code. -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ addPass(Passes, createPostOrderFunctionAttrsPass()); -+ addPass(Passes, createReversePostOrderFunctionAttrsPass()); // Add nocapture -+ addPass(Passes, createGlobalsAAWrapperPass()); // IP alias analysis -+#else - addPass(Passes, createFunctionAttrsPass()); // Add nocapture - addPass(Passes, createGlobalsModRefPass()); // IP alias analysis -+#endif - - addPass(Passes, createLICMPass()); // Hoist loop invariants - addPass(Passes, createGVNPass()); // Remove redundancies --- -2.17.1 - diff --git a/0003-llvm39-switch-KLEE_RUNTIME_BUILD_TYPE-to-Debug-Asser.patch b/0003-llvm39-switch-KLEE_RUNTIME_BUILD_TYPE-to-Debug-Asser.patch new file mode 100644 index 0000000..c95cca2 --- /dev/null +++ b/0003-llvm39-switch-KLEE_RUNTIME_BUILD_TYPE-to-Debug-Asser.patch @@ -0,0 +1,33 @@ +From: Jiri Slaby +Date: Fri, 20 Jul 2018 09:34:51 +0200 +Subject: llvm39: switch KLEE_RUNTIME_BUILD_TYPE to Debug+Asserts +Patch-mainline: no + +So that we do not optimize the library during build. It should be +optimized only on runtime, depending on the -optimize parameter. + +It could cause various failures like: +inlinable function call in a function with debug info must have a !dbg location + call void @klee_overshift_check(i64 64, i64 %int_cast_to_i64) + +Signed-off-by: Jiri Slaby +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c34b8786f313..961ab19d75df 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -520,7 +520,7 @@ set(available_klee_runtime_build_types + if (NOT KLEE_RUNTIME_BUILD_TYPE) + message(STATUS "KLEE_RUNTIME_BUILD_TYPE is not set. Setting default") + message(STATUS "The available runtime build types are: ${available_klee_runtime_build_types}") +- set(KLEE_RUNTIME_BUILD_TYPE "Release+Debug+Asserts" CACHE String ++ set(KLEE_RUNTIME_BUILD_TYPE "Debug+Asserts" CACHE String + "Options are ${available_klee_runtime_build_types}" + FORCE) + endif() +-- +2.18.0 + diff --git a/0004-llvm38-SmallString-is-always-up-to-date.patch b/0004-llvm38-SmallString-is-always-up-to-date.patch deleted file mode 100644 index e2a506e..0000000 --- a/0004-llvm38-SmallString-is-always-up-to-date.patch +++ /dev/null @@ -1,33 +0,0 @@ -From: Jiri Slaby -Date: Fri, 15 Jun 2018 08:14:39 +0200 -Subject: llvm38: SmallString is always up-to-date -Patch-mainline: no - -No need to flush it, see llvm-mirror/llvm@d4177b2 - -Signed-off-by: Jiri Slaby ---- - tools/klee/main.cpp | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp -index ab9dfe286ffb..3d73ae07fcb5 100644 ---- a/tools/klee/main.cpp -+++ b/tools/klee/main.cpp -@@ -291,7 +291,12 @@ KleeHandler::KleeHandler(int argc, char **argv) - for (; i <= INT_MAX; ++i) { - SmallString<128> d(directory); - llvm::sys::path::append(d, "klee-out-"); -- raw_svector_ostream ds(d); ds << i; ds.flush(); -+ raw_svector_ostream ds(d); -+ ds << i; -+// SmallString is always up-to-date, no need to flush. See Support/raw_ostream.h -+#if LLVM_VERSION_CODE < LLVM_VERSION(3, 8) -+ ds.flush(); -+#endif - - // create directory and try to link klee-last - if (mkdir(d.c_str(), 0775) == 0) { --- -2.17.1 - diff --git a/0012-llvm40-handle-different-header-names.patch b/0004-llvm40-handle-different-header-names.patch similarity index 76% rename from 0012-llvm40-handle-different-header-names.patch rename to 0004-llvm40-handle-different-header-names.patch index 9e73e5b..75265ad 100644 --- a/0012-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 75e71c0a557f..232cd88fd621 100644 +index 74d91a8f0122..c041be10313c 100644 --- a/lib/Module/KModule.cpp +++ b/lib/Module/KModule.cpp @@ -21,7 +21,11 @@ @@ -26,25 +26,25 @@ index 75e71c0a557f..232cd88fd621 100644 +#else #include "llvm/Bitcode/ReaderWriter.h" +#endif + #include "llvm/IR/DataLayout.h" + #include "llvm/IR/IRBuilder.h" #include "llvm/IR/Instructions.h" - #include "llvm/IR/LLVMContext.h" - #include "llvm/IR/Module.h" diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp -index ee4af254dae2..8aa070743048 100644 +index 0e87b5a6deca..c2792454d904 100644 --- a/lib/Module/ModuleUtil.cpp +++ b/lib/Module/ModuleUtil.cpp -@@ -26,7 +26,9 @@ +@@ -24,7 +24,9 @@ + #include "llvm/Object/Archive.h" #include "llvm/Object/Error.h" - #include "llvm/Support/FileSystem.h" - #include "llvm/Support/SourceMgr.h" + #include "llvm/Object/ObjectFile.h" +#if LLVM_VERSION_CODE < LLVM_VERSION(4, 0) #include "llvm/Support/DataStream.h" +#endif + #include "llvm/Support/FileSystem.h" + #include "llvm/Support/SourceMgr.h" - #if LLVM_VERSION_CODE < LLVM_VERSION(3, 5) - #include "llvm/Linker.h" -@@ -36,8 +38,13 @@ - #include "llvm/IR/AssemblyAnnotationWriter.h" +@@ -43,8 +45,13 @@ + #include "llvm/IR/DiagnosticPrinter.h" #endif +#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) @@ -59,18 +59,18 @@ 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 c0ea4fa54551..154a76feb361 100644 +index 7be5f07cdc0e..c7dc517a8eee 100644 --- a/tools/klee/main.cpp +++ b/tools/klee/main.cpp -@@ -31,7 +31,6 @@ - #include "llvm/IR/LLVMContext.h" - #include "llvm/Support/Errno.h" - #include "llvm/Support/FileSystem.h" +@@ -23,7 +23,6 @@ + #include "klee/Interpreter.h" + #include "klee/Statistics.h" + -#include "llvm/Bitcode/ReaderWriter.h" - #include "llvm/Support/CommandLine.h" - #include "llvm/Support/ManagedStatic.h" - #include "llvm/Support/MemoryBuffer.h" -@@ -45,6 +44,12 @@ + #include "llvm/IR/Constants.h" + #include "llvm/IR/IRBuilder.h" + #include "llvm/IR/InstrTypes.h" +@@ -46,6 +45,12 @@ #include "llvm/Support/system_error.h" #endif @@ -84,5 +84,5 @@ index c0ea4fa54551..154a76feb361 100644 #include #include -- -2.17.1 +2.18.0 diff --git a/0013-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 0013-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch rename to 0005-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch index b5277fb..bf1ce84 100644 --- a/0013-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 385920627641..61a54d72f48b 100644 +index 7f69a618b8ec..1a5b7b9df527 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp -@@ -1448,12 +1448,21 @@ static bool isDebugIntrinsic(const Function *f, KModule *KM) { +@@ -1480,12 +1480,21 @@ static bool isDebugIntrinsic(const Function *f, KModule *KM) { static inline const llvm::fltSemantics * fpWidthToSemantics(unsigned width) { switch(width) { @@ -35,5 +35,5 @@ index 385920627641..61a54d72f48b 100644 return 0; } -- -2.17.1 +2.18.0 diff --git a/0005-llvm38-materializeAllPermanently-was-renamed.patch b/0005-llvm38-materializeAllPermanently-was-renamed.patch deleted file mode 100644 index 82c4653..0000000 --- a/0005-llvm38-materializeAllPermanently-was-renamed.patch +++ /dev/null @@ -1,31 +0,0 @@ -From: Jiri Slaby -Date: Fri, 15 Jun 2018 08:19:39 +0200 -Subject: llvm38: materializeAllPermanently was renamed -Patch-mainline: no - -To materializeAll. Happened in LLVM commit 838f8a4b1db2. - -Signed-off-by: Jiri Slaby ---- - lib/Module/ModuleUtil.cpp | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp -index b07d3d2fe348..ce52819d2579 100644 ---- a/lib/Module/ModuleUtil.cpp -+++ b/lib/Module/ModuleUtil.cpp -@@ -639,7 +639,11 @@ Module *klee::loadModule(LLVMContext &ctx, const std::string &path, std::string - auto module = *errorOrModule; - #endif - -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ if (auto ec = module->materializeAll()) { -+#else - if (auto ec = module->materializeAllPermanently()) { -+#endif - errorMsg = ec.message(); - return nullptr; - } --- -2.17.1 - diff --git a/0006-llvm38-adapt-to-new-Linker-linkModules.patch b/0006-llvm38-adapt-to-new-Linker-linkModules.patch deleted file mode 100644 index 5967cce..0000000 --- a/0006-llvm38-adapt-to-new-Linker-linkModules.patch +++ /dev/null @@ -1,72 +0,0 @@ -From: Jiri Slaby -Date: Fri, 15 Jun 2018 08:21:39 +0200 -Subject: llvm38: adapt to new Linker::linkModules -Patch-mainline: no - -LLVM commit d912be98f8eb changed the prototype of linkModules to accept -std::unique_ptr. Adapt to that. - -Signed-off-by: Jiri Slaby ---- - lib/Module/ModuleUtil.cpp | 15 +++++++++++++-- - 1 file changed, 13 insertions(+), 2 deletions(-) - -diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp -index ce52819d2579..025b7374fcf9 100644 ---- a/lib/Module/ModuleUtil.cpp -+++ b/lib/Module/ModuleUtil.cpp -@@ -343,7 +343,9 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er - KLEE_DEBUG_WITH_TYPE("klee_linker", dbgs() << "Found " << GV->getName() << - " in " << M->getModuleIdentifier() << "\n"); - --#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ if (Linker::linkModules(*composite, std::unique_ptr(M))) -+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) - if (Linker::LinkModules(composite, M)) - #else - if (Linker::LinkModules(composite, M, Linker::DestroySource, &errorMessage)) -@@ -360,8 +362,10 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er - // Link succeed, now clean up - modulesLoadedOnPass++; - KLEE_DEBUG_WITH_TYPE("klee_linker", dbgs() << "Linking succeeded.\n"); -- -+// M was owned by linkModules function -+#if LLVM_VERSION_CODE < LLVM_VERSION(3, 8) - delete M; -+#endif - archiveModules[i] = 0; - - // We need to recompute the undefined symbols in the composite module -@@ -427,7 +431,9 @@ Module *klee::linkWithLibrary(Module *module, - std::string ErrorMessage; - - if (magic == sys::fs::file_magic::bitcode) { -+#if LLVM_VERSION_CODE < LLVM_VERSION(3, 8) - Module *Result = 0; -+#endif - #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) - #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) - ErrorOr > ResultErr = -@@ -445,6 +451,10 @@ Module *klee::linkWithLibrary(Module *module, - ErrorMessage.c_str()); - } - -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ if (Linker::linkModules(*module, std::move(ResultErr.get()))) { -+ ErrorMessage = "linking error"; -+#else - #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) - Result = ResultErr->release(); - #elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) -@@ -456,6 +466,7 @@ Module *klee::linkWithLibrary(Module *module, - ErrorMessage = "linking error"; - #else - if (Linker::LinkModules(module, Result, Linker::DestroySource, &ErrorMessage)) { -+#endif - #endif - klee_error("Link with library %s failed: %s", libraryName.c_str(), - ErrorMessage.c_str()); --- -2.17.1 - diff --git a/0006-llvm40-errorOr-and-similar.patch b/0006-llvm40-errorOr-and-similar.patch new file mode 100644 index 0000000..6ec7328 --- /dev/null +++ b/0006-llvm40-errorOr-and-similar.patch @@ -0,0 +1,53 @@ +From: Jiri Slaby +Date: Wed, 7 Jun 2017 14:58:29 +0200 +Subject: llvm40: errorOr and similar +Patch-mainline: no + +Signed-off-by: Jiri Slaby +--- + lib/Module/ModuleUtil.cpp | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp +index c2792454d904..7f4bdb49380a 100644 +--- a/lib/Module/ModuleUtil.cpp ++++ b/lib/Module/ModuleUtil.cpp +@@ -432,7 +432,7 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context, + if (auto archive = dyn_cast(arch)) { + // Load all bitcode files into memory + #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) +- Error Err; ++ Error Err = Error::success(); + for (object::Archive::child_iterator AI = archive->child_begin(Err), + AE = archive->child_end(); + AI != AE; ++AI) +@@ -460,8 +460,14 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context, + #else + object::Archive::child_iterator childOrErr = AI; + #endif ++#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) ++ Expected memberNameErr = childOrErr->getName(); ++ ec = memberNameErr ? std::error_code() : ++ errorToErrorCode(memberNameErr.takeError()); ++#else + ErrorOr memberNameErr = childOrErr->getName(); + ec = memberNameErr.getError(); ++#endif + if (!ec) { + memberName = memberNameErr.get(); + #else +@@ -492,7 +498,10 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context, + #endif + if (ec) { + // If we can't open as a binary object file its hopefully a bitcode file +-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) ++#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) ++ Expected buff = childOrErr->getMemoryBufferRef(); ++ ec = buff ? std::error_code() : errorToErrorCode(buff.takeError()); ++#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) + ErrorOr buff = childOrErr->getMemoryBufferRef(); + ec = buff.getError(); + #elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) +-- +2.18.0 + diff --git a/0015-llvm-use-chrono-helpers-from-LLVM-4.0.patch b/0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch similarity index 97% rename from 0015-llvm-use-chrono-helpers-from-LLVM-4.0.patch rename to 0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch index da58b96..4556bdd 100644 --- a/0015-llvm-use-chrono-helpers-from-LLVM-4.0.patch +++ b/0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch @@ -69,10 +69,10 @@ index 220e260c975e..12522c866439 100644 } diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp -index 7881f0e84be5..0be727fbc346 100644 +index 97e7fccb5e3c..ecf90bd0126a 100644 --- a/lib/Core/StatsTracker.cpp +++ b/lib/Core/StatsTracker.cpp -@@ -286,6 +286,29 @@ void StatsTracker::done() { +@@ -285,6 +285,29 @@ void StatsTracker::done() { void StatsTracker::stepInstruction(ExecutionState &es) { if (OutputIStats) { if (TrackInstructionTime) { @@ -102,7 +102,7 @@ index 7881f0e84be5..0be727fbc346 100644 static sys::TimeValue lastNowTime(0,0),lastUserTime(0,0); if (lastUserTime.seconds()==0 && lastUserTime.nanoseconds()==0) { -@@ -301,6 +324,7 @@ void StatsTracker::stepInstruction(ExecutionState &es) { +@@ -300,6 +323,7 @@ void StatsTracker::stepInstruction(ExecutionState &es) { lastUserTime = user; lastNowTime = now; } @@ -195,5 +195,5 @@ index da96981079ae..a223b39ada57 100644 + +#endif -- -2.17.1 +2.18.0 diff --git a/0007-llvm38-archive-child-iterator-changes.patch b/0007-llvm38-archive-child-iterator-changes.patch deleted file mode 100644 index 269877e..0000000 --- a/0007-llvm38-archive-child-iterator-changes.patch +++ /dev/null @@ -1,61 +0,0 @@ -From: Jiri Slaby -Date: Fri, 15 Jun 2018 08:28:22 +0200 -Subject: llvm38: archive child iterator changes -Patch-mainline: no - -After LLVM commit 25569fdcdab0, archive iterator returns -object::Archive::Child instead of child_iterator, adapt to that. - -Signed-off-by: Jiri Slaby ---- - lib/Module/ModuleUtil.cpp | 20 ++++++++++++++++---- - 1 file changed, 16 insertions(+), 4 deletions(-) - -diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp -index 025b7374fcf9..e6d592b135b6 100644 ---- a/lib/Module/ModuleUtil.cpp -+++ b/lib/Module/ModuleUtil.cpp -@@ -207,8 +207,19 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er - - StringRef memberName; - #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) -- ErrorOr memberNameErr = AI->getName(); -- std::error_code ec = memberNameErr.getError(); -+ std::error_code ec; -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ ErrorOr childErr = *AI; -+ ec = childErr.getError(); -+ if (ec) { -+ errorMessage = ec.message(); -+ return false; -+ } -+#else -+ object::Archive::child_iterator childErr = AI; -+#endif -+ ErrorOr memberNameErr = childErr->getName(); -+ ec = memberNameErr.getError(); - if (!ec) { - memberName = memberNameErr.get(); - #else -@@ -226,7 +237,8 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er - } - - #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) -- ErrorOr > child = AI->getAsBinary(); -+ ErrorOr > child = -+ childErr->getAsBinary(); - ec = child.getError(); - #else - OwningPtr child; -@@ -235,7 +247,7 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er - if (ec) { - // If we can't open as a binary object file its hopefully a bitcode file - #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) -- ErrorOr buff = AI->getMemoryBufferRef(); -+ ErrorOr buff = childErr->getMemoryBufferRef(); - ec = buff.getError(); - #elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) - ErrorOr > buffErr = AI->getMemoryBuffer(); --- -2.17.1 - diff --git a/0016-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch b/0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch similarity index 94% rename from 0016-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch rename to 0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch index 8f01086..26e49a2 100644 --- a/0016-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch +++ b/0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch @@ -27,10 +27,10 @@ index 5fb9f4ec5c2f..bf7cb6ff0bea 100644 CurTy = 0; } diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index 61a54d72f48b..f994a82e2df7 100644 +index 1a5b7b9df527..51d36b352e5c 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp -@@ -2589,8 +2589,7 @@ void Executor::computeOffsets(KGEPInstruction *kgepi, TypeIt ib, TypeIt ie) { +@@ -2621,8 +2621,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 61a54d72f48b..f994a82e2df7 100644 uint64_t elementSize = kmodule->targetData->getTypeStoreSize(set->getElementType()); Value *operand = ii.getOperand(); -@@ -2604,7 +2603,24 @@ void Executor::computeOffsets(KGEPInstruction *kgepi, TypeIt ib, TypeIt ie) { +@@ -2636,7 +2635,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 61a54d72f48b..f994a82e2df7 100644 } kgepi->offset = constantOffset->getZExtValue(); -- -2.17.1 +2.18.0 diff --git a/0008-llvm38-no-more-implicit-iterators.patch b/0008-llvm38-no-more-implicit-iterators.patch deleted file mode 100644 index 965a9a7..0000000 --- a/0008-llvm38-no-more-implicit-iterators.patch +++ /dev/null @@ -1,78 +0,0 @@ -From: =?UTF-8?q?Richard=20Trembeck=C3=BD?= -Date: Wed, 4 May 2016 15:21:45 +0200 -Subject: llvm38: no more implicit iterators -Patch-mainline: no - -LLVM commit eac309550f25 removed implicit iterator conversions. So we -have to get the iterators explicitly now. - -Signed-off-by: Jiri Slaby ---- - lib/Core/StatsTracker.cpp | 4 ++++ - lib/Module/IntrinsicCleaner.cpp | 4 ++++ - lib/Module/LowerSwitch.cpp | 8 ++++++++ - 3 files changed, 16 insertions(+) - -diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp -index f2a989e28439..7881f0e84be5 100644 ---- a/lib/Core/StatsTracker.cpp -+++ b/lib/Core/StatsTracker.cpp -@@ -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 { -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ res.push_back(&*(++(i->getIterator()))); -+#else - res.push_back(&*(++BasicBlock::iterator(i))); -+#endif - } - - return res; -diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp -index 3729ff82cd9d..0f7eb223a2d3 100644 ---- a/lib/Module/IntrinsicCleaner.cpp -+++ b/lib/Module/IntrinsicCleaner.cpp -@@ -110,7 +110,11 @@ 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) -+ IRBuilder<> builder(ii->getParent(), ii->getIterator()); -+#else - IRBuilder<> builder(ii->getParent(), ii); -+#endif - - Value *op1 = ii->getArgOperand(0); - Value *op2 = ii->getArgOperand(1); -diff --git a/lib/Module/LowerSwitch.cpp b/lib/Module/LowerSwitch.cpp -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, - // iterate through all the cases, creating a new BasicBlock for each - for (CaseItr it = begin; it < end; ++it) { - BasicBlock *newBlock = BasicBlock::Create(F->getContext(), "NodeBlock"); -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ Function::iterator FI = origBlock->getIterator(); -+#else - Function::iterator FI = origBlock; -+#endif - F->getBasicBlockList().insert(++FI, newBlock); - - ICmpInst *cmpInst = -@@ -101,7 +105,11 @@ void LowerSwitchPass::processSwitchInst(SwitchInst *SI) { - // if-then statements go to this and the PHI nodes are happy. - BasicBlock* newDefault = BasicBlock::Create(F->getContext(), "newDefault"); - -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ F->getBasicBlockList().insert(defaultBlock->getIterator(), newDefault); -+#else - F->getBasicBlockList().insert(defaultBlock, newDefault); -+#endif - BranchInst::Create(defaultBlock, newDefault); - - // If there is an entry in any PHI nodes for the default edge, make sure --- -2.17.1 - diff --git a/0009-llvm38-test-change-some-tests.patch b/0009-llvm38-test-change-some-tests.patch deleted file mode 100644 index 2db27ca..0000000 --- a/0009-llvm38-test-change-some-tests.patch +++ /dev/null @@ -1,155 +0,0 @@ -From: Jiri Slaby -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 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.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.leq37.ll b/test/Feature/BitcastAlias.leq37.ll -new file mode 100644 -index 000000000000..e860acb24594 ---- /dev/null -+++ 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 -+; 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/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 %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..c29ec8a62243 ---- /dev/null -+++ 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 -+; 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 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.17.1 - diff --git a/0017-llvm40-gep_type_iterator-has-no-operator.patch b/0009-llvm40-gep_type_iterator-has-no-operator.patch similarity index 99% rename from 0017-llvm40-gep_type_iterator-has-no-operator.patch rename to 0009-llvm40-gep_type_iterator-has-no-operator.patch index e78279c..3fd8a5b 100644 --- a/0017-llvm40-gep_type_iterator-has-no-operator.patch +++ b/0009-llvm40-gep_type_iterator-has-no-operator.patch @@ -28,5 +28,5 @@ index a352db3339c4..7718ae9d0ccb 100644 const StructLayout *SL = kmodule->targetData->getStructLayout(STy); base = base->Add( -- -2.17.1 +2.18.0 diff --git a/0018-llvm50-avoid-on-function-arg_begin.patch b/0010-llvm50-avoid-on-function-arg_begin.patch similarity index 81% rename from 0018-llvm50-avoid-on-function-arg_begin.patch rename to 0010-llvm50-avoid-on-function-arg_begin.patch index ba6053a..ce17eeb 100644 --- a/0018-llvm50-avoid-on-function-arg_begin.patch +++ b/0010-llvm50-avoid-on-function-arg_begin.patch @@ -18,10 +18,10 @@ Signed-off-by: Jiri Slaby 1 file changed, 8 insertions(+) diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp -index 154a76feb361..def83b584167 100644 +index c7dc517a8eee..883be83a4130 100644 --- a/tools/klee/main.cpp +++ b/tools/klee/main.cpp -@@ -658,7 +658,11 @@ static int initEnv(Module *mainModule) { +@@ -655,7 +655,11 @@ static void initEnv(Module *mainModule) { Instruction *firstInst = &*(mainFn->begin()->begin()); Value *oldArgc = &*(mainFn->arg_begin()); @@ -33,9 +33,9 @@ index 154a76feb361..def83b584167 100644 AllocaInst* argcPtr = new AllocaInst(oldArgc->getType(), "argcPtr", firstInst); -@@ -1117,7 +1121,11 @@ static llvm::Module *linkWithUclibc(llvm::Module *mainModule, StringRef libDir) - args.push_back(llvm::ConstantExpr::getBitCast(userMainFn, - ft->getParamType(0))); +@@ -1057,7 +1061,11 @@ createLibCWrapper(std::vector> &modules, + args.push_back( + llvm::ConstantExpr::getBitCast(inModuleRefernce, ft->getParamType(0))); args.push_back(&*(stub->arg_begin())); // argc +#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0) + args.push_back(&*(stub->arg_begin() + 1)); // argv @@ -46,5 +46,5 @@ index 154a76feb361..def83b584167 100644 args.push_back(Constant::getNullValue(ft->getParamType(4))); // app_fini args.push_back(Constant::getNullValue(ft->getParamType(5))); // rtld_fini -- -2.17.1 +2.18.0 diff --git a/0019-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch b/0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch similarity index 89% rename from 0019-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch rename to 0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch index 3be6409..2469674 100644 --- a/0019-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch +++ b/0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch @@ -12,10 +12,10 @@ Signed-off-by: Jiri Slaby 1 file changed, 4 insertions(+) diff --git a/lib/Expr/Expr.cpp b/lib/Expr/Expr.cpp -index f73d1614c250..5433d9211ead 100644 +index a5c7f652e976..65e858c3336d 100644 --- a/lib/Expr/Expr.cpp +++ b/lib/Expr/Expr.cpp -@@ -328,7 +328,11 @@ ref ConstantExpr::fromMemory(void *address, Width width) { +@@ -333,7 +333,11 @@ ref ConstantExpr::fromMemory(void *address, Width width) { // FIXME: what about machines without x87 support? default: return ConstantExpr::alloc(llvm::APInt(width, @@ -28,5 +28,5 @@ index f73d1614c250..5433d9211ead 100644 } } -- -2.17.1 +2.18.0 diff --git a/0020-llvm50-handle-getOrInsertFunction-terminator.patch b/0012-llvm50-handle-getOrInsertFunction-terminator.patch similarity index 61% rename from 0020-llvm50-handle-getOrInsertFunction-terminator.patch rename to 0012-llvm50-handle-getOrInsertFunction-terminator.patch index f209c3d..d1b5ddd 100644 --- a/0020-llvm50-handle-getOrInsertFunction-terminator.patch +++ b/0012-llvm50-handle-getOrInsertFunction-terminator.patch @@ -10,11 +10,11 @@ Since commit 9d54400bba7eb04bca80fce97fa170452d19eaf1. Signed-off-by: Jiri Slaby --- - include/klee/Config/Version.h | 6 ++++++ - lib/Module/Checks.cpp | 8 ++++---- - lib/Module/IntrinsicCleaner.cpp | 3 ++- - tools/klee/main.cpp | 20 ++++++++++---------- - 4 files changed, 22 insertions(+), 15 deletions(-) + include/klee/Config/Version.h | 6 ++++++ + lib/Module/Checks.cpp | 8 ++++---- + lib/Module/IntrinsicCleaner.cpp | 3 ++- + tools/klee/main.cpp | 4 ++-- + 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/include/klee/Config/Version.h b/include/klee/Config/Version.h index 532051602fe3..a02ce28baaae 100644 @@ -58,11 +58,11 @@ index aac63e1d9854..406b3045e527 100644 } diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp -index 0f7eb223a2d3..4d323b8e8344 100644 +index c48952c28004..ab16a2654492 100644 --- a/lib/Module/IntrinsicCleaner.cpp +++ b/lib/Module/IntrinsicCleaner.cpp @@ -210,7 +210,8 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) { - // Intrisic instruction "llvm.trap" found. Directly lower it to + // Intrinsic instruction "llvm.trap" found. Directly lower it to // a call of the abort() function. Function *F = cast( - M.getOrInsertFunction("abort", Type::getVoidTy(ctx), NULL)); @@ -72,10 +72,10 @@ index 0f7eb223a2d3..4d323b8e8344 100644 F->setDoesNotThrow(); diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp -index def83b584167..ff87d210b863 100644 +index 883be83a4130..c0805f457717 100644 --- a/tools/klee/main.cpp +++ b/tools/klee/main.cpp -@@ -678,8 +678,8 @@ static int initEnv(Module *mainModule) { +@@ -675,8 +675,8 @@ static void initEnv(Module *mainModule) { cast(mainModule->getOrInsertFunction("klee_init_env", Type::getVoidTy(ctx), argcPtr->getType(), @@ -86,35 +86,6 @@ index def83b584167..ff87d210b863 100644 assert(initEnvFn); std::vector args; args.push_back(argcPtr); -@@ -1038,20 +1038,20 @@ static llvm::Module *linkWithUclibc(llvm::Module *mainModule, StringRef libDir) - mainModule->getOrInsertFunction("realpath", - PointerType::getUnqual(i8Ty), - PointerType::getUnqual(i8Ty), -- PointerType::getUnqual(i8Ty), -- NULL); -+ PointerType::getUnqual(i8Ty) -+ KLEE_LLVM_GOIF_TERMINATOR); - mainModule->getOrInsertFunction("getutent", -- PointerType::getUnqual(i8Ty), -- NULL); -+ PointerType::getUnqual(i8Ty) -+ KLEE_LLVM_GOIF_TERMINATOR); - mainModule->getOrInsertFunction("__fgetc_unlocked", - Type::getInt32Ty(ctx), -- PointerType::getUnqual(i8Ty), -- NULL); -+ PointerType::getUnqual(i8Ty) -+ KLEE_LLVM_GOIF_TERMINATOR); - mainModule->getOrInsertFunction("__fputc_unlocked", - Type::getInt32Ty(ctx), - Type::getInt32Ty(ctx), -- PointerType::getUnqual(i8Ty), -- NULL); -+ PointerType::getUnqual(i8Ty) -+ KLEE_LLVM_GOIF_TERMINATOR); - } - - f = mainModule->getFunction("__ctype_get_mb_cur_max"); -- -2.17.1 +2.18.0 diff --git a/0021-llvm50-SwitchInst-case-functions-now-return-pointers.patch b/0013-llvm50-SwitchInst-case-functions-now-return-pointers.patch similarity index 92% rename from 0021-llvm50-SwitchInst-case-functions-now-return-pointers.patch rename to 0013-llvm50-SwitchInst-case-functions-now-return-pointers.patch index cfed880..d8dfb78 100644 --- a/0021-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 f994a82e2df7..bca2eb6e06a7 100644 +index 51d36b352e5c..75af0fd09bd8 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp -@@ -1641,7 +1641,11 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { +@@ -1673,7 +1673,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 f994a82e2df7..bca2eb6e06a7 100644 } else { // Handle possible different branch targets -- -2.17.1 +2.18.0 diff --git a/0014-llvm40-errorOr-and-similar.patch b/0014-llvm40-errorOr-and-similar.patch deleted file mode 100644 index 776e435..0000000 --- a/0014-llvm40-errorOr-and-similar.patch +++ /dev/null @@ -1,128 +0,0 @@ -From: Jiri Slaby -Date: Wed, 7 Jun 2017 14:58:29 +0200 -Subject: llvm40: errorOr and similar -Patch-mainline: no - -Signed-off-by: Jiri Slaby ---- - lib/Module/ModuleUtil.cpp | 50 ++++++++++++++++++++++++++++++++------- - 1 file changed, 41 insertions(+), 9 deletions(-) - -diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp -index 8aa070743048..ad847de0b368 100644 ---- a/lib/Module/ModuleUtil.cpp -+++ b/lib/Module/ModuleUtil.cpp -@@ -204,7 +204,7 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er - KLEE_DEBUG_WITH_TYPE("klee_linker", dbgs() << "Loading modules\n"); - // Load all bitcode files in to memory so we can examine their symbols - #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -- Error Err; -+ Error Err = Error::success(); - for (object::Archive::child_iterator AI = archive->child_begin(Err), - AE = archive->child_end(); AI != AE; ++AI) - #elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) -@@ -229,8 +229,14 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er - #else - object::Archive::child_iterator childErr = AI; - #endif -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+ Expected memberNameErr = childErr->getName(); -+ ec = memberNameErr ? std::error_code() : -+ errorToErrorCode(memberNameErr.takeError()); -+#else - ErrorOr memberNameErr = childErr->getName(); - ec = memberNameErr.getError(); -+#endif - if (!ec) { - memberName = memberNameErr.get(); - #else -@@ -267,7 +273,10 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er - #endif - if (ec) { - // If we can't open as a binary object file its hopefully a bitcode file --#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+ Expected buff = childErr->getMemoryBufferRef(); -+ ec = buff ? std::error_code() : errorToErrorCode(buff.takeError()); -+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) - ErrorOr buff = childErr->getMemoryBufferRef(); - ec = buff.getError(); - #elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) -@@ -291,13 +300,20 @@ 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) --#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+ Expected > resultErr = -+ parseBitcodeFile(buff.get(), composite->getContext()); -+ ec = resultErr ? std::error_code() : -+ errorToErrorCode(resultErr.takeError()); -+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) - ErrorOr > resultErr = -+ parseBitcodeFile(buff.get(), composite->getContext()); -+ ec = resultErr.getError(); - #else - ErrorOr resultErr = --#endif - parseBitcodeFile(buff.get(), composite->getContext()); - ec = resultErr.getError(); -+#endif - if (ec) - errorMessage = ec.message(); - else -@@ -474,7 +490,12 @@ Module *klee::linkWithLibrary(Module *module, - #if LLVM_VERSION_CODE < LLVM_VERSION(3, 8) - Module *Result = 0; - #endif --#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+ Expected > ResultErr = -+ parseBitcodeFile(Buffer, Context); -+ if (!ResultErr) { -+ ErrorMessage = errorToErrorCode(ResultErr.takeError()).message(); -+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) - #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) - ErrorOr > ResultErr = - #else -@@ -680,14 +701,22 @@ Module *klee::loadModule(LLVMContext &ctx, const std::string &path, std::string - return nullptr; - } - --#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) -+ std::error_code ec; -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+ Expected> errorOrModule = -+ getOwningLazyBitcodeModule(std::move(buffer.get()), ctx); -+ ec = errorOrModule ? std::error_code() : -+ errorToErrorCode(errorOrModule.takeError()); -+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) - auto errorOrModule = getLazyBitcodeModule(std::move(buffer.get()), ctx); -+ ec = errorOrModule.getError(); - #else - auto errorOrModule = getLazyBitcodeModule(buffer->get(), ctx); -+ ec = errorOrModule.getError(); - #endif - -- if (!errorOrModule) { -- errorMsg = errorOrModule.getError().message().c_str(); -+ if (ec) { -+ errorMsg = ec.message(); - return nullptr; - } - // The module has taken ownership of the MemoryBuffer so release it -@@ -699,7 +728,10 @@ Module *klee::loadModule(LLVMContext &ctx, const std::string &path, std::string - auto module = *errorOrModule; - #endif - --#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+ if (llvm::Error err = module->materializeAll()) { -+ std::error_code ec = errorToErrorCode(std::move(err)); -+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) - if (auto ec = module->materializeAll()) { - #else - if (auto ec = module->materializeAllPermanently()) { --- -2.17.1 - diff --git a/0022-llvm50-handle-new-file_magic-s-location.patch b/0014-llvm50-handle-new-file_magic-s-location.patch similarity index 67% rename from 0022-llvm50-handle-new-file_magic-s-location.patch rename to 0014-llvm50-handle-new-file_magic-s-location.patch index c1b8857..ac521e2 100644 --- a/0022-llvm50-handle-new-file_magic-s-location.patch +++ b/0014-llvm50-handle-new-file_magic-s-location.patch @@ -6,17 +6,13 @@ Patch-mainline: no llvm 5, moved file_magic to BinaryFormat in commit 19ca2b0f9daed883c21730285d7f04424e5f5f88, so adapt to that. -Signed-off-by: Jiri Slaby - -` - Signed-off-by: Jiri Slaby --- lib/Module/ModuleUtil.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp -index ad847de0b368..5f967410568c 100644 +index 7f4bdb49380a..f1dbdb13bcff 100644 --- a/lib/Module/ModuleUtil.cpp +++ b/lib/Module/ModuleUtil.cpp @@ -14,6 +14,9 @@ @@ -26,10 +22,10 @@ index ad847de0b368..5f967410568c 100644 +#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0) +#include "llvm/BinaryFormat/Magic.h" +#endif - #include "llvm/IRReader/IRReader.h" #include "llvm/IR/Function.h" #include "llvm/IR/Instructions.h" -@@ -477,7 +480,9 @@ Module *klee::linkWithLibrary(Module *module, + #include "llvm/IR/IntrinsicInst.h" +@@ -380,13 +383,19 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context, MemoryBuffer *Buffer = bufferErr->get(); #endif @@ -40,30 +36,28 @@ index ad847de0b368..5f967410568c 100644 sys::fs::file_magic magic = sys::fs::identify_magic(Buffer.getBuffer()); #else sys::fs::file_magic magic = sys::fs::identify_magic(Buffer->getBuffer()); -@@ -486,7 +491,11 @@ Module *klee::linkWithLibrary(Module *module, - LLVMContext &Context = module->getContext(); - std::string ErrorMessage; + #endif +#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0) + if (magic == file_magic::bitcode) { +#else if (magic == sys::fs::file_magic::bitcode) { +#endif - #if LLVM_VERSION_CODE < LLVM_VERSION(3, 8) - Module *Result = 0; - #endif -@@ -538,7 +547,11 @@ Module *klee::linkWithLibrary(Module *module, - delete Result; - #endif + SMDiagnostic Err; + #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) + std::unique_ptr module(parseIR(Buffer, Err, context)); +@@ -403,7 +412,11 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context, + return true; + } +#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0) -+ } else if (magic == file_magic::archive) { ++ if (magic == file_magic::archive) { +#else - } else if (magic == sys::fs::file_magic::archive) { + if (magic == sys::fs::file_magic::archive) { +#endif #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) - Expected > arch = - object::createBinary(Buffer, &Context); + Expected > archOwner = + object::createBinary(Buffer, &context); -- -2.17.1 +2.18.0 diff --git a/0023-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch b/0015-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch similarity index 90% rename from 0023-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch rename to 0015-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch index f0406dd..e049913 100644 --- a/0023-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 bca2eb6e06a7..70337c000cd2 100644 +index 75af0fd09bd8..46fd2be42351 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp -@@ -2294,7 +2294,12 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { +@@ -2326,7 +2326,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 bca2eb6e06a7..70337c000cd2 100644 llvm::APFloat::rmTowardZero, &isExact); bindLocal(ki, state, ConstantExpr::alloc(value, resultType)); break; -@@ -2311,7 +2316,12 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { +@@ -2343,7 +2348,12 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { uint64_t value = 0; bool isExact = true; @@ -45,5 +45,5 @@ index bca2eb6e06a7..70337c000cd2 100644 bindLocal(ki, state, ConstantExpr::alloc(value, resultType)); break; -- -2.17.1 +2.18.0 diff --git a/0024-llvm50-AllocaInst-takes-address-space.patch b/0016-llvm50-AllocaInst-takes-address-space.patch similarity index 91% rename from 0024-llvm50-AllocaInst-takes-address-space.patch rename to 0016-llvm50-AllocaInst-takes-address-space.patch index 320a873..b0cbeaf 100644 --- a/0024-llvm50-AllocaInst-takes-address-space.patch +++ b/0016-llvm50-AllocaInst-takes-address-space.patch @@ -12,10 +12,10 @@ Signed-off-by: Jiri Slaby 1 file changed, 8 insertions(+) diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp -index ff87d210b863..c85fee861f03 100644 +index c0805f457717..d45a92160e59 100644 --- a/tools/klee/main.cpp +++ b/tools/klee/main.cpp -@@ -664,10 +664,18 @@ static int initEnv(Module *mainModule) { +@@ -661,10 +661,18 @@ static void initEnv(Module *mainModule) { Value *oldArgv = &*(++mainFn->arg_begin()); #endif @@ -35,5 +35,5 @@ index ff87d210b863..c85fee861f03 100644 /* Insert void klee_init_env(int* argc, char*** argv) */ std::vector params; -- -2.17.1 +2.18.0 diff --git a/0025-llvm50-Intrinsic-objectsize-has-three-arguments.patch b/0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch similarity index 94% rename from 0025-llvm50-Intrinsic-objectsize-has-three-arguments.patch rename to 0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch index cb1d2c8..88e909a 100644 --- a/0025-llvm50-Intrinsic-objectsize-has-three-arguments.patch +++ b/0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch @@ -14,10 +14,10 @@ Signed-off-by: Jiri Slaby 1 file changed, 16 insertions(+) diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp -index 4d323b8e8344..e32eeb5880e6 100644 +index ab16a2654492..19807ce08583 100644 --- a/lib/Module/IntrinsicCleaner.cpp +++ b/lib/Module/IntrinsicCleaner.cpp -@@ -226,13 +226,29 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) { +@@ -227,13 +227,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. @@ -48,5 +48,5 @@ index 4d323b8e8344..e32eeb5880e6 100644 IntegerType *intType = dyn_cast(ii->getType()); assert(intType && "intrinsic does not have integer return type"); -- -2.17.1 +2.18.0 diff --git a/0026-llvm50-test-change-objectsize.patch b/0018-llvm50-test-change-objectsize.patch similarity index 99% rename from 0026-llvm50-test-change-objectsize.patch rename to 0018-llvm50-test-change-objectsize.patch index 900d2f3..a9ffc80 100644 --- a/0026-llvm50-test-change-objectsize.patch +++ b/0018-llvm50-test-change-objectsize.patch @@ -95,5 +95,5 @@ index 3a111f99c619..95070e66e45c 100644 declare void @abort() noreturn nounwind -- -2.17.1 +2.18.0 diff --git a/0027-llvm50-test-add-disable-O0-optnone-to-O0.patch b/0019-llvm50-test-add-disable-O0-optnone-to-O0.patch similarity index 85% rename from 0027-llvm50-test-add-disable-O0-optnone-to-O0.patch rename to 0019-llvm50-test-add-disable-O0-optnone-to-O0.patch index 3c25384..7183730 100644 --- a/0027-llvm50-test-add-disable-O0-optnone-to-O0.patch +++ b/0019-llvm50-test-add-disable-O0-optnone-to-O0.patch @@ -7,141 +7,181 @@ Otherwise optimizations done in klee won't have any effect. Signed-off-by: Jiri Slaby --- - test/CXX/ArrayNew.cpp | 2 +- - test/CXX/New.cpp | 2 +- - test/CXX/SimpleVirtual.cpp | 2 +- - test/CXX/StaticConstructor.cpp | 2 +- - test/CXX/StaticDestructor.cpp | 2 +- - test/CXX/Trivial.cpp | 2 +- - test/Coverage/ReadArgs.c | 2 +- - test/Coverage/ReplayOutDir.c | 2 +- - test/Feature/AliasFunction.c | 2 +- - test/Feature/AliasFunctionExit.c | 2 +- - test/Feature/ByteSwap.c | 2 +- - test/Feature/CheckForImpliedValue.c.failing | 2 +- - test/Feature/CompressedExprLogging.c | 2 +- - test/Feature/DanglingConcreteReadExpr.c | 2 +- - test/Feature/DoubleFree.c | 2 +- - test/Feature/DumpStatesOnHalt.c | 2 +- - test/Feature/ExitOnErrorType.c | 2 +- - test/Feature/ExprLogging.c | 2 +- - test/Feature/FloatingPt.c | 2 +- - test/Feature/InAndOutOfBounds.c | 2 +- - test/Feature/IsSymbolic.c | 2 +- - test/Feature/KleeReportError.c | 2 +- - test/Feature/LargeReturnTypes.cpp | 2 +- - test/Feature/LinkLLVMLib.c | 4 ++-- - test/Feature/LongDouble.c | 2 +- - test/Feature/LongDoubleSupport.c | 2 +- - test/Feature/MultipleFreeResolution.c | 2 +- - test/Feature/MultipleReadResolution.c | 2 +- - test/Feature/MultipleReallocResolution.c | 2 +- - test/Feature/MultipleWriteResolution.c | 2 +- - test/Feature/OneFreeError.c | 2 +- - test/Feature/OneOutOfBounds.c | 2 +- - test/Feature/Optimize.c | 2 +- - test/Feature/OverlappedError.c | 2 +- - test/Feature/OvershiftCheck.c | 2 +- - test/Feature/PreferCex.c | 2 +- - test/Feature/RaiseAsm.c | 2 +- - test/Feature/Realloc.c | 2 +- - test/Feature/ReplayPath.c | 4 ++-- - test/Feature/RewriteEqualities.c | 2 +- - test/Feature/Searchers.c | 2 +- - test/Feature/SolverTimeout.c | 2 +- - test/Feature/SourceMapping.c | 2 +- - test/Feature/VarArgLongDouble.c | 2 +- - test/Feature/Vararg.c | 2 +- - test/Feature/WithLibc.c | 2 +- - test/Feature/arithmetic-right-overshift-sym-conc.c | 2 +- - test/Feature/consecutive_divide_by_zero.c | 2 +- - test/Feature/const_array_opt1.c | 2 +- - test/Feature/left-overshift-sym-conc.c | 2 +- - test/Feature/logical-right-overshift-sym-conc.c | 2 +- - test/Feature/srem.c | 2 +- - test/Feature/ubsan_signed_overflow.c | 2 +- - test/Feature/ubsan_unsigned_overflow.c | 2 +- - test/Programs/pcregrep.c | 2 +- - test/Replay/libkleeruntest/replay_invalid_klee_assume.c | 2 +- - test/Replay/libkleeruntest/replay_invalid_klee_choose.c | 2 +- - test/Replay/libkleeruntest/replay_invalid_klee_range.c | 2 +- - test/Replay/libkleeruntest/replay_invalid_num_objects.c | 2 +- - test/Replay/libkleeruntest/replay_invalid_object_names.c | 2 +- - test/Replay/libkleeruntest/replay_invalid_object_size.c | 2 +- - test/Replay/libkleeruntest/replay_klee_prefer_cex.c | 2 +- - test/Replay/libkleeruntest/replay_posix_runtime.c | 2 +- - test/Replay/libkleeruntest/replay_simple.c | 2 +- - test/Replay/libkleeruntest/replay_two_objects.c | 2 +- - test/Runtime/POSIX/DirConsistency.c | 4 ++-- - test/Runtime/POSIX/DirSeek.c | 2 +- - test/Runtime/POSIX/FDNumbers.c | 2 +- - test/Runtime/POSIX/FD_Fail.c | 2 +- - test/Runtime/POSIX/FD_Fail2.c | 2 +- - test/Runtime/POSIX/Fcntl.c | 2 +- - test/Runtime/POSIX/FilePerm.c | 2 +- - test/Runtime/POSIX/FileTime.c | 2 +- - test/Runtime/POSIX/FreeArgv.c | 2 +- - test/Runtime/POSIX/Futimesat.c | 2 +- - test/Runtime/POSIX/Getenv.c | 2 +- - test/Runtime/POSIX/Ioctl.c | 2 +- - test/Runtime/POSIX/Isatty.c | 2 +- - test/Runtime/POSIX/MixedConcreteSymbolic.c | 2 +- - test/Runtime/POSIX/Openat.c | 2 +- - test/Runtime/POSIX/PrgName.c | 2 +- - test/Runtime/POSIX/Read1.c | 2 +- - test/Runtime/POSIX/Replay.c | 2 +- - test/Runtime/POSIX/SELinux/SELinux.c | 2 +- - test/Runtime/POSIX/SeedAndFail.c | 2 +- - test/Runtime/POSIX/Stdin.c | 2 +- - test/Runtime/POSIX/Write1.c | 2 +- - test/Runtime/POSIX/Write2.c | 2 +- - .../2007-10-08-optimization-calls-wrong-libc-functions.c | 2 +- - test/Runtime/Uclibc/2008-03-04-libc-atexit-uses-dso-handle.c | 2 +- - test/Solver/Z3ConstantArray.c | 2 +- - test/VectorInstructions/extract_element.c | 2 +- - test/VectorInstructions/extract_element_symbolic.c | 2 +- - test/VectorInstructions/floating_point_ops_constant.c | 2 +- - test/VectorInstructions/insert_element.c | 2 +- - test/VectorInstructions/insert_element_symbolic.c | 2 +- - test/VectorInstructions/integer_ops_constant.c | 2 +- - test/VectorInstructions/integer_ops_signed_symbolic.c | 2 +- - test/VectorInstructions/integer_ops_unsigned_symbolic.c | 2 +- - test/VectorInstructions/shuffle_element.c | 2 +- - test/lit.cfg | 2 +- - test/lit.site.cfg.in | 4 ++++ - .../2007-07-25-invalid-stp-array-binding-to-objectstate.c | 2 +- - test/regression/2007-07-30-unflushed-byte.c | 2 +- - .../2007-08-01-cache-unclear-on-overwrite-flushed.c | 2 +- - test/regression/2007-08-06-64bit-shift.c | 2 +- - test/regression/2007-08-06-access-after-free.c | 2 +- - test/regression/2007-08-08-free-zero.c | 2 +- - test/regression/2007-08-16-valid-write-to-freed-object.c | 2 +- - test/regression/2007-10-11-free-of-alloca.c | 2 +- - test/regression/2007-10-12-failed-make-symbolic-after-copy.c | 2 +- - test/regression/2008-03-04-free-of-global.c | 2 +- - test/regression/2008-03-11-free-of-malloc-zero.c | 2 +- - test/regression/2008-04-10-bad-alloca-free.c | 2 +- - test/regression/2008-05-23-gep-with-global-const.c | 2 +- - test/regression/2012-05-13-asm-causes-aborts.c | 2 +- - test/regression/2014-07-04-unflushed-error-report.c | 2 +- - test/regression/2014-09-13-debug-info.c | 2 +- - test/regression/2014-12-08-ashr.c | 2 +- - test/regression/2015-06-22-struct-write.c | 2 +- - test/regression/2015-08-05-invalid-fork.c | 2 +- - test/regression/2015-08-30-empty-constraints.c | 2 +- - test/regression/2015-08-30-sdiv-1.c | 2 +- - test/regression/2016-04-14-sdiv-2.c | 2 +- - test/regression/2016-06-28-div-zero-bug.c | 2 +- - test/regression/2016-08-06-klee-get-obj-size.c | 2 +- - test/regression/2016-08-11-entry-point-internalize-pass.c | 2 +- - test/regression/2016-08-12-empty-file.c | 2 +- - test/regression/2016-11-24-bitcast-weak-alias.c | 2 +- - test/regression/2016-12-14-alloc-alignment.c | 2 +- - test/regression/2017-02-21-pathOS-id.c | 2 +- - test/regression/2017-03-23-early-exit-log-stats.c | 2 +- - .../regression/2018-05-05-number-instructions-dumped-states.c | 2 +- - 133 files changed, 139 insertions(+), 135 deletions(-) + runtime/CMakeLists.txt | 8 +++++++- + runtime/Makefile.cmake.bitcode.rules | 2 +- + test/CXX/ArrayNew.cpp | 2 +- + test/CXX/New.cpp | 2 +- + test/CXX/SimpleVirtual.cpp | 2 +- + test/CXX/StaticConstructor.cpp | 2 +- + test/CXX/StaticDestructor.cpp | 2 +- + test/CXX/Trivial.cpp | 2 +- + test/Coverage/ReadArgs.c | 2 +- + test/Coverage/ReplayOutDir.c | 2 +- + test/Feature/AliasFunction.c | 2 +- + test/Feature/AliasFunctionExit.c | 2 +- + test/Feature/ByteSwap.c | 2 +- + test/Feature/CheckForImpliedValue.c.failing | 2 +- + test/Feature/CompressedExprLogging.c | 2 +- + test/Feature/DanglingConcreteReadExpr.c | 2 +- + test/Feature/DoubleFree.c | 2 +- + test/Feature/DumpStatesOnHalt.c | 2 +- + test/Feature/ExitOnErrorType.c | 2 +- + test/Feature/ExprLogging.c | 2 +- + test/Feature/FloatingPt.c | 2 +- + test/Feature/InAndOutOfBounds.c | 2 +- + test/Feature/IsSymbolic.c | 2 +- + test/Feature/KleeReportError.c | 2 +- + test/Feature/LargeReturnTypes.cpp | 2 +- + test/Feature/LinkLLVMLib.c | 4 ++-- + test/Feature/LongDouble.c | 2 +- + test/Feature/LongDoubleSupport.c | 2 +- + test/Feature/MultipleFreeResolution.c | 2 +- + test/Feature/MultipleReadResolution.c | 2 +- + test/Feature/MultipleReallocResolution.c | 2 +- + test/Feature/MultipleWriteResolution.c | 2 +- + test/Feature/OneFreeError.c | 2 +- + test/Feature/OneOutOfBounds.c | 2 +- + test/Feature/Optimize.c | 2 +- + test/Feature/OverlappedError.c | 2 +- + test/Feature/OvershiftCheck.c | 2 +- + test/Feature/PreferCex.c | 2 +- + test/Feature/RaiseAsm.c | 2 +- + test/Feature/Realloc.c | 2 +- + test/Feature/ReplayPath.c | 4 ++-- + test/Feature/RewriteEqualities.c | 2 +- + test/Feature/Searchers.c | 2 +- + test/Feature/SolverTimeout.c | 2 +- + test/Feature/SourceMapping.c | 2 +- + test/Feature/VarArgLongDouble.c | 2 +- + test/Feature/Vararg.c | 2 +- + test/Feature/WithLibc.c | 2 +- + test/Feature/arithmetic-right-overshift-sym-conc.c | 2 +- + test/Feature/consecutive_divide_by_zero.c | 2 +- + test/Feature/const_array_opt1.c | 2 +- + test/Feature/left-overshift-sym-conc.c | 2 +- + test/Feature/logical-right-overshift-sym-conc.c | 2 +- + test/Feature/srem.c | 2 +- + test/Feature/ubsan_signed_overflow.c | 2 +- + test/Feature/ubsan_unsigned_overflow.c | 2 +- + test/Programs/pcregrep.c | 2 +- + test/Replay/libkleeruntest/replay_invalid_klee_assume.c | 2 +- + test/Replay/libkleeruntest/replay_invalid_klee_choose.c | 2 +- + test/Replay/libkleeruntest/replay_invalid_klee_range.c | 2 +- + test/Replay/libkleeruntest/replay_invalid_num_objects.c | 2 +- + test/Replay/libkleeruntest/replay_invalid_object_names.c | 2 +- + test/Replay/libkleeruntest/replay_invalid_object_size.c | 2 +- + test/Replay/libkleeruntest/replay_klee_prefer_cex.c | 2 +- + test/Replay/libkleeruntest/replay_posix_runtime.c | 2 +- + test/Replay/libkleeruntest/replay_simple.c | 2 +- + test/Replay/libkleeruntest/replay_two_objects.c | 2 +- + test/Runtime/POSIX/DirConsistency.c | 4 ++-- + test/Runtime/POSIX/DirSeek.c | 2 +- + test/Runtime/POSIX/FDNumbers.c | 2 +- + test/Runtime/POSIX/FD_Fail.c | 2 +- + test/Runtime/POSIX/FD_Fail2.c | 2 +- + test/Runtime/POSIX/Fcntl.c | 2 +- + test/Runtime/POSIX/FilePerm.c | 2 +- + test/Runtime/POSIX/FileTime.c | 2 +- + test/Runtime/POSIX/FreeArgv.c | 2 +- + test/Runtime/POSIX/Futimesat.c | 2 +- + test/Runtime/POSIX/Getenv.c | 2 +- + test/Runtime/POSIX/Ioctl.c | 2 +- + test/Runtime/POSIX/Isatty.c | 2 +- + test/Runtime/POSIX/MixedConcreteSymbolic.c | 2 +- + test/Runtime/POSIX/Openat.c | 2 +- + test/Runtime/POSIX/PrgName.c | 2 +- + test/Runtime/POSIX/Read1.c | 2 +- + test/Runtime/POSIX/Replay.c | 2 +- + test/Runtime/POSIX/SELinux/SELinux.c | 2 +- + test/Runtime/POSIX/SeedAndFail.c | 2 +- + test/Runtime/POSIX/Stdin.c | 2 +- + test/Runtime/POSIX/Write1.c | 2 +- + test/Runtime/POSIX/Write2.c | 2 +- + .../2007-10-08-optimization-calls-wrong-libc-functions.c | 2 +- + .../Uclibc/2008-03-04-libc-atexit-uses-dso-handle.c | 2 +- + test/Solver/Z3ConstantArray.c | 2 +- + test/VectorInstructions/extract_element.c | 2 +- + test/VectorInstructions/extract_element_symbolic.c | 2 +- + test/VectorInstructions/floating_point_ops_constant.c | 2 +- + test/VectorInstructions/insert_element.c | 2 +- + test/VectorInstructions/insert_element_symbolic.c | 2 +- + test/VectorInstructions/integer_ops_constant.c | 2 +- + test/VectorInstructions/integer_ops_signed_symbolic.c | 2 +- + test/VectorInstructions/integer_ops_unsigned_symbolic.c | 2 +- + test/VectorInstructions/shuffle_element.c | 2 +- + test/lit.cfg | 2 +- + test/lit.site.cfg.in | 4 ++++ + .../2007-07-25-invalid-stp-array-binding-to-objectstate.c | 2 +- + test/regression/2007-07-30-unflushed-byte.c | 2 +- + .../2007-08-01-cache-unclear-on-overwrite-flushed.c | 2 +- + test/regression/2007-08-06-64bit-shift.c | 2 +- + test/regression/2007-08-06-access-after-free.c | 2 +- + test/regression/2007-08-08-free-zero.c | 2 +- + test/regression/2007-08-16-valid-write-to-freed-object.c | 2 +- + test/regression/2007-10-11-free-of-alloca.c | 2 +- + .../2007-10-12-failed-make-symbolic-after-copy.c | 2 +- + test/regression/2008-03-04-free-of-global.c | 2 +- + test/regression/2008-03-11-free-of-malloc-zero.c | 2 +- + test/regression/2008-04-10-bad-alloca-free.c | 2 +- + test/regression/2008-05-23-gep-with-global-const.c | 2 +- + test/regression/2012-05-13-asm-causes-aborts.c | 2 +- + test/regression/2014-07-04-unflushed-error-report.c | 2 +- + test/regression/2014-09-13-debug-info.c | 2 +- + test/regression/2014-12-08-ashr.c | 2 +- + test/regression/2015-06-22-struct-write.c | 2 +- + test/regression/2015-08-05-invalid-fork.c | 2 +- + test/regression/2015-08-30-empty-constraints.c | 2 +- + test/regression/2015-08-30-sdiv-1.c | 2 +- + test/regression/2016-04-14-sdiv-2.c | 2 +- + test/regression/2016-06-28-div-zero-bug.c | 2 +- + test/regression/2016-08-06-klee-get-obj-size.c | 2 +- + test/regression/2016-08-11-entry-point-internalize-pass.c | 2 +- + test/regression/2016-08-12-empty-file.c | 2 +- + test/regression/2016-11-24-bitcast-weak-alias.c | 2 +- + test/regression/2016-12-14-alloc-alignment.c | 2 +- + test/regression/2017-02-21-pathOS-id.c | 2 +- + test/regression/2017-03-23-early-exit-log-stats.c | 2 +- + .../2018-05-05-number-instructions-dumped-states.c | 2 +- + 135 files changed, 147 insertions(+), 137 deletions(-) +diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt +index 61693afc2cab..e3619f3d4609 100644 +--- a/runtime/CMakeLists.txt ++++ b/runtime/CMakeLists.txt +@@ -91,13 +91,19 @@ ExternalProject_Add(BuildKLEERuntimes + INSTALL_COMMAND "${CMAKE_COMMAND}" -E echo "" # Dummy command + ) + ++set(O0OPT "-O0") ++if (${LLVM_VERSION_MAJOR} GREATER 4) ++ set(O0OPT "${O0OPT} -Xclang -disable-O0-optnone") ++endif() ++ ++ + # Use `ExternalProject_Add_Step` with `ALWAYS` argument instead of directly + # building in `ExternalProject_Add` with `BUILD_ALWAYS` argument due to lack of + # support for the `BUILD_ALWAYS` argument in CMake < 3.1. + ExternalProject_Add_Step(BuildKLEERuntimes RuntimeBuild + # `env` is used here to make sure `MAKEFLAGS` of KLEE's build + # is not propagated into the bitcode build system. +- COMMAND ${ENV_BINARY} MAKEFLAGS="" ${MAKE_BINARY} -f Makefile.cmake.bitcode all ++ COMMAND ${ENV_BINARY} MAKEFLAGS="" O0OPT=${O0OPT} ${MAKE_BINARY} -f Makefile.cmake.bitcode all + ALWAYS ${EXTERNAL_PROJECT_BUILD_ALWAYS_ARG} + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + ${EXTERNAL_PROJECT_ADD_STEP_USES_TERMINAL_ARG} +diff --git a/runtime/Makefile.cmake.bitcode.rules b/runtime/Makefile.cmake.bitcode.rules +index 41b2814e1241..db731ac5df3a 100644 +--- a/runtime/Makefile.cmake.bitcode.rules ++++ b/runtime/Makefile.cmake.bitcode.rules +@@ -40,7 +40,7 @@ endif + ifeq ($(IS_RELEASE),1) + LLVMCC.Flags += -O2 + else +-LLVMCC.Flags += -O0 ++LLVMCC.Flags += $(O0OPT) + endif + + # Handle assertion flags diff --git a/test/CXX/ArrayNew.cpp b/test/CXX/ArrayNew.cpp index 6a54083aafac..baad95fe4473 100644 --- a/test/CXX/ArrayNew.cpp @@ -625,7 +665,7 @@ index 0eca8213f384..8c07041d89f6 100644 // RUN: %klee --output-dir=%t.klee-out --libc=klee %t2.bc > %t3.log // RUN: echo "good" > %t3.good diff --git a/test/Feature/arithmetic-right-overshift-sym-conc.c b/test/Feature/arithmetic-right-overshift-sym-conc.c -index 63b93db32ed9..2fff2a3a2724 100644 +index 6a9bbc2113ac..4a0bc36f1989 100644 --- a/test/Feature/arithmetic-right-overshift-sym-conc.c +++ b/test/Feature/arithmetic-right-overshift-sym-conc.c @@ -1,4 +1,4 @@ @@ -808,7 +848,7 @@ index 77e2f5d2567f..8155060d4266 100644 // RUN: %klee --output-dir=%t.klee-out --search=dfs %t.bc // RUN: test -f %t.klee-out/test000001.ktest diff --git a/test/Replay/libkleeruntest/replay_two_objects.c b/test/Replay/libkleeruntest/replay_two_objects.c -index 779e1b656eb6..692797e1fdc0 100644 +index 7cbfe3063910..a8f1b87b8bd7 100644 --- a/test/Replay/libkleeruntest/replay_two_objects.c +++ b/test/Replay/libkleeruntest/replay_two_objects.c @@ -1,4 +1,4 @@ @@ -994,7 +1034,7 @@ index 2b8cfa9d3858..00deab5f08e2 100644 // RUN: %klee --output-dir=%t.klee-out --exit-on-error --posix-runtime %t.bc --sym-files 1 8 >%t.log diff --git a/test/Runtime/POSIX/Replay.c b/test/Runtime/POSIX/Replay.c -index ba11f05f169b..eba6bbaf04d4 100644 +index 2b166e1f84c0..f98028377d51 100644 --- a/test/Runtime/POSIX/Replay.c +++ b/test/Runtime/POSIX/Replay.c @@ -1,4 +1,4 @@ @@ -1086,106 +1126,97 @@ index 482679e923ef..041e675dc4f1 100644 // RUN: %klee --output-dir=%t.klee-out -solver-backend=z3 -write-cvcs -write-smt2s -debug-z3-dump-queries=%t.smt2 %t1.bc // RUN: cat %t.klee-out/test000001.smt2 | FileCheck --check-prefix=TEST-CASE %s diff --git a/test/VectorInstructions/extract_element.c b/test/VectorInstructions/extract_element.c -index 008691e39a6d..0a5f155a1538 100644 +index 5507d1d9ac5e..76034f183cfb 100644 --- a/test/VectorInstructions/extract_element.c +++ b/test/VectorInstructions/extract_element.c -@@ -1,5 +1,5 @@ - // REQUIRES: geq-llvm-3.4 +@@ -1,4 +1,4 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc +// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc // RUN: rm -rf %t.klee-out // NOTE: Have to pass `--optimize=false` to avoid vector operations being // constant folded away. diff --git a/test/VectorInstructions/extract_element_symbolic.c b/test/VectorInstructions/extract_element_symbolic.c -index f75bad623a5e..c20536d457c2 100644 +index 268a63f6ab4e..1833eb34edcb 100644 --- a/test/VectorInstructions/extract_element_symbolic.c +++ b/test/VectorInstructions/extract_element_symbolic.c -@@ -1,5 +1,5 @@ - // REQUIRES: geq-llvm-3.4 +@@ -1,4 +1,4 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc +// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc // RUN: rm -rf %t.klee-out // RUN: not %klee --output-dir=%t.klee-out --exit-on-error %t1.bc > %t.log 2>&1 // RUN: FileCheck -input-file=%t.log %s diff --git a/test/VectorInstructions/floating_point_ops_constant.c b/test/VectorInstructions/floating_point_ops_constant.c -index 4e567a309580..ddb4af43e4c1 100644 +index c9777fa9c8fa..3d9fd098408e 100644 --- a/test/VectorInstructions/floating_point_ops_constant.c +++ b/test/VectorInstructions/floating_point_ops_constant.c -@@ -1,5 +1,5 @@ - // REQUIRES: geq-llvm-3.4 +@@ -1,4 +1,4 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc +// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc // RUN: rm -rf %t.klee-out // NOTE: Have to pass `--optimize=false` to avoid vector operations being // constant folded away. diff --git a/test/VectorInstructions/insert_element.c b/test/VectorInstructions/insert_element.c -index 8397dcebbcf0..6b77ab13d203 100644 +index 7e79250d5ecc..772da9874987 100644 --- a/test/VectorInstructions/insert_element.c +++ b/test/VectorInstructions/insert_element.c -@@ -1,5 +1,5 @@ - // REQUIRES: geq-llvm-3.4 +@@ -1,4 +1,4 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc +// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc // RUN: rm -rf %t.klee-out // NOTE: Have to pass `--optimize=false` to avoid vector operations being // constant folded away. diff --git a/test/VectorInstructions/insert_element_symbolic.c b/test/VectorInstructions/insert_element_symbolic.c -index 76df899c95fa..1080f367efd0 100644 +index 66666a71cd07..f75d3a09b0ac 100644 --- a/test/VectorInstructions/insert_element_symbolic.c +++ b/test/VectorInstructions/insert_element_symbolic.c -@@ -1,5 +1,5 @@ - // REQUIRES: geq-llvm-3.4 +@@ -1,4 +1,4 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc +// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc // RUN: rm -rf %t.klee-out // RUN: not %klee --output-dir=%t.klee-out --exit-on-error %t1.bc > %t.log 2>&1 // RUN: FileCheck -input-file=%t.log %s diff --git a/test/VectorInstructions/integer_ops_constant.c b/test/VectorInstructions/integer_ops_constant.c -index 189ad4eeed54..355075e6375b 100644 +index 8993ff2e9486..920465ff2e06 100644 --- a/test/VectorInstructions/integer_ops_constant.c +++ b/test/VectorInstructions/integer_ops_constant.c -@@ -1,5 +1,5 @@ - // REQUIRES: geq-llvm-3.4 +@@ -1,4 +1,4 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc +// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc // RUN: rm -rf %t.klee-out // NOTE: Have to pass `--optimize=false` to avoid vector operations being // constant folded away. diff --git a/test/VectorInstructions/integer_ops_signed_symbolic.c b/test/VectorInstructions/integer_ops_signed_symbolic.c -index 80f4e420561b..7d9944222eff 100644 +index c2f6b5f9af31..10ede925ce68 100644 --- a/test/VectorInstructions/integer_ops_signed_symbolic.c +++ b/test/VectorInstructions/integer_ops_signed_symbolic.c -@@ -1,5 +1,5 @@ - // REQUIRES: geq-llvm-3.4 +@@ -1,4 +1,4 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc +// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc // RUN: rm -rf %t.klee-out // NOTE: Have to pass `--optimize=false` to avoid vector operations being // optimized away. diff --git a/test/VectorInstructions/integer_ops_unsigned_symbolic.c b/test/VectorInstructions/integer_ops_unsigned_symbolic.c -index 56b1739809d6..794716761a87 100644 +index 8a7330c0d02b..aadeb585990d 100644 --- a/test/VectorInstructions/integer_ops_unsigned_symbolic.c +++ b/test/VectorInstructions/integer_ops_unsigned_symbolic.c -@@ -1,5 +1,5 @@ - // REQUIRES: geq-llvm-3.4 +@@ -1,4 +1,4 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc +// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc // RUN: rm -rf %t.klee-out // NOTE: Have to pass `--optimize=false` to avoid vector operations being // optimized away. diff --git a/test/VectorInstructions/shuffle_element.c b/test/VectorInstructions/shuffle_element.c -index cf991b036983..55955fd347e9 100644 +index 32653490934b..bf1f83f646d8 100644 --- a/test/VectorInstructions/shuffle_element.c +++ b/test/VectorInstructions/shuffle_element.c -@@ -1,5 +1,5 @@ - // REQUIRES: geq-llvm-3.4 +@@ -1,4 +1,4 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc +// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc // RUN: rm -rf %t.klee-out // NOTE: Have to pass `--optimize=false` to avoid vector operations being // constant folded away. diff --git a/test/lit.cfg b/test/lit.cfg -index e570f9b227e3..a26f9c0381d3 100644 +index 780973d79086..11f3992c5eec 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -84,7 +84,7 @@ if config.test_exec_root is None: @@ -1198,7 +1229,7 @@ index e570f9b227e3..a26f9c0381d3 100644 value = getattr(config, name, None) if value == None: diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in -index 300c70c53c2d..1f4b8c72d1b5 100644 +index 6a90bb4cacbc..dbc292fb68a0 100644 --- a/test/lit.site.cfg.in +++ b/test/lit.site.cfg.in @@ -21,6 +21,10 @@ config.llvmgxx = "@LLVMCXX@" @@ -1529,5 +1560,5 @@ index 5f2af61e0d89..8d183b77a010 100644 // RUN: %klee -stop-after-n-instructions=1 --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck %s -- -2.17.1 +2.18.0 diff --git a/0020-llvm50-CallSite.paramHasAttr-is-indexed-from-0.patch b/0020-llvm50-CallSite.paramHasAttr-is-indexed-from-0.patch new file mode 100644 index 0000000..b5c9b0e --- /dev/null +++ b/0020-llvm50-CallSite.paramHasAttr-is-indexed-from-0.patch @@ -0,0 +1,46 @@ +From: Jiri Slaby +Date: Fri, 20 Jul 2018 10:06:29 +0200 +Subject: llvm50: CallSite.paramHasAttr is indexed from 0 +Patch-mainline: no + +Since LLVM 5 commit 1f8f0490690b, CallSite.paramHasAttr is indexed from +0, so make sure we use correct indexing in klee. And use +CallSite.hasRetAttr for return attributes. + +Signed-off-by: Jiri Slaby +--- + lib/Core/Executor.cpp | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp +index 46fd2be42351..f05561e7fe82 100644 +--- a/lib/Core/Executor.cpp ++++ b/lib/Core/Executor.cpp +@@ -1543,7 +1543,11 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { + CallSite(cast(caller))); + + // XXX need to check other param attrs ? +- bool isSExt = cs.paramHasAttr(0, llvm::Attribute::SExt); ++#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0) ++ bool isSExt = cs.hasRetAttr(llvm::Attribute::SExt); ++#else ++ bool isSExt = cs.paramHasAttr(0, llvm::Attribute::SExt); ++#endif + if (isSExt) { + result = SExtExpr::create(result, to); + } else { +@@ -1837,7 +1841,11 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { + + if (from != to) { + // XXX need to check other param attrs ? ++#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0) ++ bool isSExt = cs.paramHasAttr(i, llvm::Attribute::SExt); ++#else + bool isSExt = cs.paramHasAttr(i+1, llvm::Attribute::SExt); ++#endif + if (isSExt) { + arguments[i] = SExtExpr::create(arguments[i], to); + } else { +-- +2.18.0 + diff --git a/0028-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch b/0021-llvm6-SetVersionPrinter-now-passes-down-a-stream.patch similarity index 97% rename from 0028-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch rename to 0021-llvm6-SetVersionPrinter-now-passes-down-a-stream.patch index 03eac0b..5c1fc61 100644 --- a/0028-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch +++ b/0021-llvm6-SetVersionPrinter-now-passes-down-a-stream.patch @@ -1,6 +1,6 @@ From: Jiri Slaby Date: Mon, 21 May 2018 15:12:44 +0200 -Subject: llvm60: SetVersionPrinter now passes down a stream +Subject: llvm6: SetVersionPrinter now passes down a stream Patch-mainline: no I.e. klee::printVersion should now have a parameter -- the output @@ -81,5 +81,5 @@ index d39249df023f..b7f2b6ff347a 100644 llvm::cl::PrintVersionMessage(); } -- -2.17.1 +2.18.0 diff --git a/0029-llvm60-handle-headers-renaming.patch b/0022-llvm6-handle-headers-renaming.patch similarity index 92% rename from 0029-llvm60-handle-headers-renaming.patch rename to 0022-llvm6-handle-headers-renaming.patch index 5806af9..0955b18 100644 --- a/0029-llvm60-handle-headers-renaming.patch +++ b/0022-llvm6-handle-headers-renaming.patch @@ -1,6 +1,6 @@ From: Jiri Slaby Date: Mon, 21 May 2018 15:14:41 +0200 -Subject: llvm60: handle headers renaming +Subject: llvm6: handle headers renaming Patch-mainline: no Some headers were moved from llvm/Target/ to llvm/CodeGen/. Handle that. @@ -11,7 +11,7 @@ Signed-off-by: Jiri Slaby 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Module/RaiseAsm.cpp b/lib/Module/RaiseAsm.cpp -index d9b3e40154ba..d478ff828796 100644 +index 4967a2fa8578..eef22fb81553 100644 --- a/lib/Module/RaiseAsm.cpp +++ b/lib/Module/RaiseAsm.cpp @@ -18,10 +18,16 @@ @@ -33,5 +33,5 @@ index d9b3e40154ba..d478ff828796 100644 using namespace llvm; -- -2.17.1 +2.18.0 diff --git a/_servicedata b/_servicedata index 10253e0..e67b0c5 100644 --- a/_servicedata +++ b/_servicedata @@ -1,4 +1,4 @@ git://github.com/klee/klee.git - d2fbdf74493d69e73fbfaedc0d59e593dfd7c69d \ No newline at end of file + b893d2158ce001da97f2c741ac8320b4c3b9ed53 \ No newline at end of file diff --git a/klee-1.4.0+20180614.tar.xz b/klee-1.4.0+20180614.tar.xz deleted file mode 100644 index 82c7925..0000000 --- a/klee-1.4.0+20180614.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d03fcc9a6ed53e1e2e7784813b5a3f612b09cc33fda8db68e7aade78ec839bb5 -size 592052 diff --git a/klee-1.4.0+20180829.tar.xz b/klee-1.4.0+20180829.tar.xz new file mode 100644 index 0000000..742e514 --- /dev/null +++ b/klee-1.4.0+20180829.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7f46c097ddadb8c4b6a3ec70294b7a8d2c8d6451a67913d698813832695a046c +size 597812 diff --git a/klee.changes b/klee.changes index a92c0ed..cf58307 100644 --- a/klee.changes +++ b/klee.changes @@ -1,3 +1,109 @@ +------------------------------------------------------------------- +Sun Sep 02 08:39:37 UTC 2018 - opensuse-packaging@opensuse.org + +- Update to version 1.4.0+20180829: + * klee-stats: add TResolve(%) to --print-all + * llvm.sh: fix patch source paths + * Disabled unit testing in default build + * Fixed runtest library to handle the case of a NULL "name" argument in klee_make_symbolic. Changed a test case to check this feature. + * Replace remaining *Inst::Create() calls with llvm::Builder + * [clang-format]Allow longer codelines in test/ + * test: remove geq-llvm-3.4 + * remove last comma from -debug-print-escaping-functions + * test/Feature/EscapingFunctionsAlias.c: clarify alias(ee) casting + * add declarations to escapingFunctions + * ModuleUtil: improve and test valueIsOnlyCalled + * fix: LLVM 3.5, begin_user() instead of begin_use() + * ExternalDispatcher: setErrorStr for EngineBuilder + * travis CI: add LLVM 3.8 build tests + * llvm38: test, change some tests + * llvm38: no more implicit iterators + * llvm38: archive child iterator changes + * llvm38: adapt to new Linker::linkModules + * llvm38: SmallString is always up-to-date + * llvm38: handle optimization passes changes + * llvm38: no rounding in APFloat + * Fix uploading of coverage information from inside of docker + * Add missing curl + * Fix slow Mac Travis build: wildcard is not expanded with quotes + * Added "override" in Executor.h to silence compiler warnings (and ran clang-format on patch) + * Removed support for klee_make_symbolic with 2 arguments. This has been deprecated for many years now and causes problems during replay. Changed and simplified affected test case. + * test: remove undefined behaviour + * Enabled tcmalloc by default + * Link dynamic libraries with specific paths instead of resolving them during runtime + * Fix incorrect invocation of klee + * Fix uninitialized memory: enums have to be initialized + * Add missing out-of-tree include files directory for TCMalloc + * Fix compiler warnings if assertions are disabled + * Support sanitizer suppression files with lit-based testing + * Extensive updates to the build script for dependencies and docker + * runtime: remove obsolete code for building modules instead of archives + * Reorder linking and optimizations + * Reorganise runtime libraries provided by KLEE + * Removed obsolete script + * test/lit.cfg: remove obsolete hack from (LLVM < 3.0 is no longer supported) + * CMake: use cmake_{push,pop}_check_state + * CMake: check for ctype and mallinfo functions with CXX instead of C compiler + * fix out of range access in KleeHandler::getKTestFilesInDir + * Explicitly initialize value to squelch a potentially uninitialized value warning + * Fix the final -Wimplicit-fallthrough warning + * Make ConstantExpr hashing function faster and modify affected test +- added patches: + * 0003-llvm39-switch-KLEE_RUNTIME_BUILD_TYPE-to-Debug-Asser.patch + * 0005-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch + * 0020-llvm50-CallSite.paramHasAttr-is-indexed-from-0.patch +- removed patches (in upstream now): + * 0001-test-remove-undefined-behaviour.patch + * 0002-llvm38-no-rounding-in-APFloat.patch + * 0003-llvm38-handle-optimization-passes-changes.patch + * 0004-llvm38-SmallString-is-always-up-to-date.patch + * 0005-llvm38-materializeAllPermanently-was-renamed.patch + * 0006-llvm38-adapt-to-new-Linker-linkModules.patch + * 0007-llvm38-archive-child-iterator-changes.patch + * 0008-llvm38-no-more-implicit-iterators.patch + * 0009-llvm38-test-change-some-tests.patch +- renamed patches: + * 0010-llvm-make-KLEE-compile-against-LLVM-3.9.patch + -> 0001-llvm-make-KLEE-compile-against-LLVM-3.9.patch + * 0011-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch + -> 0002-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch + * 0012-llvm40-handle-different-header-names.patch + -> 0003-llvm39-switch-KLEE_RUNTIME_BUILD_TYPE-to-Debug-Asser.patch + * 0013-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch + -> 0004-llvm40-handle-different-header-names.patch + * 0014-llvm40-errorOr-and-similar.patch + -> 0006-llvm40-errorOr-and-similar.patch + * 0015-llvm-use-chrono-helpers-from-LLVM-4.0.patch + -> 0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch + * 0016-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch + -> 0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch + * 0017-llvm40-gep_type_iterator-has-no-operator.patch + -> 0009-llvm40-gep_type_iterator-has-no-operator.patch + * 0018-llvm50-avoid-on-function-arg_begin.patch + -> 0010-llvm50-avoid-on-function-arg_begin.patch + * 0019-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch + -> 0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch + * 0020-llvm50-handle-getOrInsertFunction-terminator.patch + -> 0012-llvm50-handle-getOrInsertFunction-terminator.patch + * 0021-llvm50-SwitchInst-case-functions-now-return-pointers.patch + -> 0013-llvm50-SwitchInst-case-functions-now-return-pointers.patch + * 0022-llvm50-handle-new-file_magic-s-location.patch + -> 0014-llvm50-handle-new-file_magic-s-location.patch + * 0023-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch + -> 0015-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch + * 0024-llvm50-AllocaInst-takes-address-space.patch + -> 0016-llvm50-AllocaInst-takes-address-space.patch + * 0025-llvm50-Intrinsic-objectsize-has-three-arguments.patch + -> 0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch + * 0026-llvm50-test-change-objectsize.patch + -> 0018-llvm50-test-change-objectsize.patch + * 0027-llvm50-test-add-disable-O0-optnone-to-O0.patch + -> 0019-llvm50-test-add-disable-O0-optnone-to-O0.patch + * 0028-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch + -> 0021-llvm6-SetVersionPrinter-now-passes-down-a-stream.patch + * 0029-llvm60-handle-headers-renaming.patch + -> 0022-llvm6-handle-headers-renaming.patch + ------------------------------------------------------------------- Sat Jun 16 09:09:56 UTC 2018 - opensuse-packaging@opensuse.org diff --git a/klee.spec b/klee.spec index 2215608..bb098dc 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+20180614 +%define version_unconverted 1.4.0+20180829 %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+20180614 +Version: 1.4.0+20180829 Release: 0 Url: http://klee.github.io/ Source0: %{name}-%{version}.tar.xz @@ -39,35 +39,28 @@ 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 -Patch201: 0001-test-remove-undefined-behaviour.patch -Patch202: 0002-llvm38-no-rounding-in-APFloat.patch -Patch203: 0003-llvm38-handle-optimization-passes-changes.patch -Patch204: 0004-llvm38-SmallString-is-always-up-to-date.patch -Patch205: 0005-llvm38-materializeAllPermanently-was-renamed.patch -Patch206: 0006-llvm38-adapt-to-new-Linker-linkModules.patch -Patch207: 0007-llvm38-archive-child-iterator-changes.patch -Patch208: 0008-llvm38-no-more-implicit-iterators.patch -Patch209: 0009-llvm38-test-change-some-tests.patch -Patch210: 0010-llvm-make-KLEE-compile-against-LLVM-3.9.patch -Patch211: 0011-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch -Patch212: 0012-llvm40-handle-different-header-names.patch -Patch213: 0013-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch -Patch214: 0014-llvm40-errorOr-and-similar.patch -Patch215: 0015-llvm-use-chrono-helpers-from-LLVM-4.0.patch -Patch216: 0016-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch -Patch217: 0017-llvm40-gep_type_iterator-has-no-operator.patch -Patch218: 0018-llvm50-avoid-on-function-arg_begin.patch -Patch219: 0019-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch -Patch220: 0020-llvm50-handle-getOrInsertFunction-terminator.patch -Patch221: 0021-llvm50-SwitchInst-case-functions-now-return-pointers.patch -Patch222: 0022-llvm50-handle-new-file_magic-s-location.patch -Patch223: 0023-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch -Patch224: 0024-llvm50-AllocaInst-takes-address-space.patch -Patch225: 0025-llvm50-Intrinsic-objectsize-has-three-arguments.patch -Patch226: 0026-llvm50-test-change-objectsize.patch -Patch227: 0027-llvm50-test-add-disable-O0-optnone-to-O0.patch -Patch228: 0028-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch -Patch229: 0029-llvm60-handle-headers-renaming.patch +Patch201: 0001-llvm-make-KLEE-compile-against-LLVM-3.9.patch +Patch202: 0002-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch +Patch203: 0003-llvm39-switch-KLEE_RUNTIME_BUILD_TYPE-to-Debug-Asser.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-llvm50-test-add-disable-O0-optnone-to-O0.patch +Patch220: 0020-llvm50-CallSite.paramHasAttr-is-indexed-from-0.patch +Patch221: 0021-llvm6-SetVersionPrinter-now-passes-down-a-stream.patch +Patch222: 0022-llvm6-handle-headers-renaming.patch BuildRequires: clang%{llvm_version} BuildRequires: cmake @@ -94,36 +87,7 @@ information on what KLEE is and what it can do, see the OSDI 2008 paper. %prep %setup -q - -%patch201 -p1 -%patch202 -p1 -%patch203 -p1 -%patch204 -p1 -%patch205 -p1 -%patch206 -p1 -%patch207 -p1 -%patch208 -p1 -%patch209 -p1 -%patch210 -p1 -%patch211 -p1 -%patch212 -p1 -%patch213 -p1 -%patch214 -p1 -%patch215 -p1 -%patch216 -p1 -%patch217 -p1 -%patch218 -p1 -%patch219 -p1 -%patch220 -p1 -%patch221 -p1 -%patch222 -p1 -%patch223 -p1 -%patch224 -p1 -%patch225 -p1 -%patch226 -p1 -%patch227 -p1 -%patch228 -p1 -%patch229 -p1 +%autopatch -p1 mkdir -p build/test/ cp %{SOURCE2} build/test/ @@ -181,8 +145,9 @@ ninja check %{_libdir}/libkleeRuntest.so* %dir %{_libdir}/klee/ %dir %{_libdir}/klee/runtime/ -%{_libdir}/klee/runtime/klee-libc.bc -%{_libdir}/klee/runtime/kleeRuntimeIntrinsic.bc +%{_libdir}/klee/runtime/libklee-libc.bca +%{_libdir}/klee/runtime/libkleeRuntimeFreeStanding.bca +%{_libdir}/klee/runtime/libkleeRuntimeIntrinsic.bca %if %{with_uclibc} %{_libdir}/klee/runtime/klee-uclibc.bca %{_libdir}/klee/runtime/libkleeRuntimePOSIX.bca