diff --git a/CMakeLists.txt b/CMakeLists.txt index 14fca2cde..050a7fae7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ if(LLVM_DIR OR APPLE) # local LLVM build message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") add_definitions(${LLVM_DEFINITIONS}) # TODO: bitwriter is needed only for evmcc - llvm_map_components_to_libnames(LLVM_LIBS core support mcjit x86asmparser x86codegen bitwriter) + llvm_map_components_to_libnames(LLVM_LIBS core support mcjit x86asmparser x86codegen bitwriter ipo) else() # Workaround for Ubuntu broken LLVM package message(STATUS "Using llvm-3.5-dev package from Ubuntu. If does not work, build LLVM and set -DLLVM_DIR=llvm-build/share/llvm/cmake") diff --git a/libevmjit/Optimizer.cpp b/libevmjit/Optimizer.cpp index 2b8e41bd3..84a7c3a6a 100644 --- a/libevmjit/Optimizer.cpp +++ b/libevmjit/Optimizer.cpp @@ -3,6 +3,7 @@ #include "preprocessor/llvm_includes_start.h" #include #include +#include #include "preprocessor/llvm_includes_end.h" namespace dev @@ -15,6 +16,10 @@ namespace jit bool optimize(llvm::Module& _module) { auto pm = llvm::PassManager{}; + //pm.add(llvm::createFunctionInliningPass(2, 2)); // Produces invalid IR + pm.add(llvm::createCFGSimplificationPass()); + //pm.add(llvm::createInstructionCombiningPass()); // Produces invalid runtime results + pm.add(llvm::createAggressiveDCEPass()); pm.add(llvm::createLowerSwitchPass()); return pm.run(_module); }