summarylogtreecommitdiffstats
path: root/llvm-3.8.patch
diff options
context:
space:
mode:
Diffstat (limited to 'llvm-3.8.patch')
-rw-r--r--llvm-3.8.patch183
1 files changed, 183 insertions, 0 deletions
diff --git a/llvm-3.8.patch b/llvm-3.8.patch
new file mode 100644
index 000000000000..43a05941a237
--- /dev/null
+++ b/llvm-3.8.patch
@@ -0,0 +1,183 @@
+Index: frontends/llvm/CMakeLists.txt
+===================================================================
+--- frontends/llvm/CMakeLists.txt (révision 1079)
++++ frontends/llvm/CMakeLists.txt (copie de travail)
+@@ -123,8 +123,8 @@
+ find_package(LLVM REQUIRED)
+ message(STATUS "Found LLVM ${LLVM_VERSION}")
+
+-if (NOT LLVM_VERSION EQUAL 3.7)
+- message(FATAL_ERROR "llvm 3.7 required.")
++if (LLVM_VERSION VERSION_LESS "3.7")
++ message(FATAL_ERROR "llvm 3.7 or higher required.")
+ endif()
+
+ set(LLVM_RUNTIME_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin")
+@@ -191,7 +191,6 @@
+ core
+ instcombine
+ instrumentation
+- ipa
+ ipo
+ irreader
+ mc
+@@ -204,4 +203,10 @@
+ )
+ target_link_libraries(ikos-pp ${IKOS_PP_LLVM_LIBS})
+
++if (LLVM_VERSION VERSION_LESS "3.8")
++ # IPA is only available on llvm 3.7 and below
++ llvm_map_components_to_libnames(IKOS_PP_IPA ipa)
++ target_link_libraries(ikos-pp ${IKOS_PP_IPA})
++endif()
++
+ install(TARGETS ikos-pp RUNTIME DESTINATION bin OPTIONAL)
+Index: frontends/llvm/src/ikos-pp/ikos_pp.cpp
+===================================================================
+--- frontends/llvm/src/ikos-pp/ikos_pp.cpp (révision 1079)
++++ frontends/llvm/src/ikos-pp/ikos_pp.cpp (copie de travail)
+@@ -182,10 +182,13 @@
+
+ llvm::legacy::PassManager pass_manager;
+ llvm::PassRegistry& Registry = *llvm::PassRegistry::getPassRegistry();
++
+ llvm::initializeAnalysis(Registry);
+
++#if (LLVM_VERSION_MAJOR == 3) && (LLVM_VERSION_MINOR == 7)
+ /// call graph and other IPA passes
+ llvm::initializeIPA(Registry);
++#endif
+
+ if (PPLevel == simple) {
+ // -- SSA
+@@ -251,7 +254,11 @@
+ // loop-closed SSA
+ pass_manager.add(llvm::createLCSSAPass());
+ // trivial invariants outside loops
++#if (LLVM_VERSION_MAJOR == 3) && (LLVM_VERSION_MINOR == 7)
+ pass_manager.add(llvm::createBasicAliasAnalysisPass());
++#else
++ pass_manager.add(llvm::createBasicAAWrapperPass());
++#endif
+ pass_manager.add(llvm::createLICMPass()); // LICM needs alias analysis
+ pass_manager.add(llvm::createPromoteMemoryToRegisterPass());
+ // dead loop elimination
+Index: frontends/llvm/src/passes/llvm_to_ar.cpp
+===================================================================
+--- frontends/llvm/src/passes/llvm_to_ar.cpp (révision 1079)
++++ frontends/llvm/src/passes/llvm_to_ar.cpp (copie de travail)
+@@ -457,7 +457,7 @@
+ UnifyFunctionExitNodes& ufen = getAnalysis< UnifyFunctionExitNodes >(*f);
+
+ _functions.push_back(boost::shared_ptr< ARFunction >(
+- new ARFunction(f,
++ new ARFunction(&*f,
+ ufen.getReturnBlock(),
+ ufen.getUnreachableBlock(),
+ ufen.getUnwindBlock())));
+@@ -532,7 +532,7 @@
+ for (Module::global_iterator global = m.global_begin();
+ global != m.global_end();
+ global++) {
+- _global_vars[global] = boost::shared_ptr< ARGlobalVar >(
++ _global_vars[&*global] = boost::shared_ptr< ARGlobalVar >(
+ new ARGlobalVar(UIDGenerator::nextUID()));
+ }
+
+@@ -1286,7 +1286,8 @@
+ case Instruction::FCmp:
+ case Instruction::ICmp: {
+ CmpInst* cmp = CmpInst::Create((Instruction::OtherOps)e->getOpcode(),
+- e->getPredicate(),
++ static_cast< CmpInst::Predicate >(
++ e->getPredicate()),
+ e->getOperand(0),
+ e->getOperand(1));
+ cfg.split_blocks(cmp, cmp);
+Index: frontends/llvm/src/passes/lower_cst_expr.cpp
+===================================================================
+--- frontends/llvm/src/passes/lower_cst_expr.cpp (révision 1079)
++++ frontends/llvm/src/passes/lower_cst_expr.cpp (copie de travail)
+@@ -180,7 +180,8 @@
+ Instruction::OtherOps OtherOp =
+ (Instruction::OtherOps)(CstExp->getOpcode());
+ NewInst = CmpInst::Create(OtherOp,
+- CstExp->getPredicate(),
++ static_cast< CmpInst::Predicate >(
++ CstExp->getPredicate()),
+ CstExp->getOperand(0),
+ CstExp->getOperand(1),
+ CstExp->getName(),
+Index: frontends/llvm/src/passes/mark_no_return_functions.cpp
+===================================================================
+--- frontends/llvm/src/passes/mark_no_return_functions.cpp (révision 1079)
++++ frontends/llvm/src/passes/mark_no_return_functions.cpp (copie de travail)
+@@ -73,7 +73,7 @@
+ continue;
+
+ bool mayHaveSideEffects = false;
+- for (inst_iterator It = inst_begin(F), Et = inst_end(F); It != Et; ++It)
++ for (inst_iterator It = inst_begin(&*F), Et = inst_end(&*F); It != Et; ++It)
+ mayHaveSideEffects |= It->mayHaveSideEffects();
+
+ if (mayHaveSideEffects)
+Index: frontends/llvm/src/utils/local.cpp
+===================================================================
+--- frontends/llvm/src/utils/local.cpp (révision 1079)
++++ frontends/llvm/src/utils/local.cpp (copie de travail)
+@@ -37,7 +37,13 @@
+ new UnreachableInst(I->getContext(), I);
+
+ // All instructions after this are dead.
+- BasicBlock::iterator BBI = I, BBE = BB->end();
++#if (LLVM_VERSION_MAJOR == 3) && (LLVM_VERSION_MINOR == 7)
++ BasicBlock::iterator BBI = I;
++#else
++ BasicBlock::iterator BBI = I->getIterator();
++#endif
++ BasicBlock::iterator BBE = BB->end();
++
+ while (BBI != BBE) {
+ if (!BBI->use_empty())
+ BBI->replaceAllUsesWith(UndefValue::get(BBI->getType()));
+@@ -85,7 +91,7 @@
+ ++BBI;
+ if (!isa< UnreachableInst >(BBI)) {
+ // Don't insert a call to llvm.trap right before the unreachable.
+- ikos_pp::changeToUnreachable(BBI, false);
++ ikos_pp::changeToUnreachable(&*BBI, false);
+ Changed = true;
+ }
+ break;
+@@ -142,7 +148,7 @@
+ /// change was made, false otherwise.
+ bool ikos_pp::removeUnreachableBlocks(Function& F) {
+ SmallPtrSet< BasicBlock*, 128 > Reachable;
+- bool Changed = markAliveBlocks(F.begin(), Reachable);
++ bool Changed = markAliveBlocks(&*F.begin(), Reachable);
+
+ // If there are unreachable blocks in the CFG...
+ if (Reachable.size() == F.size())
+@@ -154,17 +160,18 @@
+ // Loop over all of the basic blocks that are not reachable, dropping all of
+ // their internal references...
+ for (Function::iterator BB = ++F.begin(), E = F.end(); BB != E; ++BB) {
+- if (Reachable.count(BB))
++ if (Reachable.count(&*BB))
+ continue;
+
+- for (succ_iterator SI = succ_begin(BB), SE = succ_end(BB); SI != SE; ++SI)
++ for (succ_iterator SI = succ_begin(&*BB), SE = succ_end(&*BB); SI != SE;
++ ++SI)
+ if (Reachable.count(*SI))
+- (*SI)->removePredecessor(BB);
++ (*SI)->removePredecessor(&*BB);
+ BB->dropAllReferences();
+ }
+
+ for (Function::iterator I = ++F.begin(); I != F.end();)
+- if (!Reachable.count(I))
++ if (!Reachable.count(&*I))
+ I = F.getBasicBlockList().erase(I);
+ else
+ ++I;