Do not compile the jit if USE_EMBEDDED_COMPILER is disabled

This commit is contained in:
pyos 2018-04-25 13:43:57 +03:00
parent 1bece1de46
commit 0da110234c
2 changed files with 9 additions and 7 deletions

View File

@ -1,12 +1,13 @@
#include <Common/config.h>
#include <DataTypes/DataTypesNumber.h>
#include <Functions/FunctionFactory.h>
#include <Functions/IFunction.h>
//#if USE_EMBEDDED_COMPILER
#if USE_EMBEDDED_COMPILER
#include <llvm/IR/Constants.h>
#include <llvm/IR/IRBuilder.h>
#include <llvm/IR/Type.h>
//#endif
#endif
namespace DB
@ -23,7 +24,7 @@ class FunctionSomething : public IFunction
public:
static constexpr auto name = "something";
//#if USE_EMBEDDED_COMPILER
#if USE_EMBEDDED_COMPILER
bool isCompilable(const DataTypes & types) const override
{
return types.size() == 2 && types[0]->equals(*types[1]);
@ -35,7 +36,7 @@ public:
return static_cast<llvm::IRBuilder<>&>(builder).CreateFAdd(values[0](), values[1]());
return static_cast<llvm::IRBuilder<>&>(builder).CreateAdd(values[0](), values[1]());
}
//#endif
#endif
static FunctionPtr create(const Context &) { return std::make_shared<FunctionSomething>(); }

View File

@ -1,3 +1,4 @@
#include <Common/config.h>
#include <Common/ProfileEvents.h>
#include <Interpreters/ExpressionActions.h>
#include <Interpreters/ExpressionJIT.h>
@ -993,9 +994,9 @@ void ExpressionActions::optimizeArrayJoin()
}
}
void ExpressionActions::compileFunctions(const Names & output_columns)
void ExpressionActions::compileFunctions([[maybe_unused]] const Names & output_columns)
{
//#if USE_EMBEDDED_COMPILER
#if USE_EMBEDDED_COMPILER
LLVMContext context;
std::vector<bool> redundant(actions.size());
// an empty optional is a poisoned value prohibiting the column's producer from being removed
@ -1080,7 +1081,7 @@ void ExpressionActions::compileFunctions(const Names & output_columns)
actions.erase(std::remove_if(actions.begin(), actions.end(), [&](const auto&) { return redundant[i++]; }), actions.end());
// TODO: insert `REMOVE_COLUMN`s according to new dependency sets
context.finalize();
//#endif
#endif
}