ExecutionEngine: drop PassManager integration

Originally, ExecutionEngine was created before MLIR had a proper pass
    management infrastructure or an LLVM IR dialect (using the LLVM target
    directly).  It has been running a bunch of lowering passes to convert the input
    IR from Standard+Affine dialects to LLVM IR and, later, to the LLVM IR dialect.
    This is no longer necessary and is even undesirable for compilation flows that
    perform their own conversion to the LLVM IR dialect.  Drop this integration and
    make ExecutionEngine accept only the LLVM IR dialect.  Users of the
    ExecutionEngine can call the relevant passes themselves.

--

PiperOrigin-RevId: 249004676
This commit is contained in:
Alex Zinenko
2019-05-20 01:31:29 -07:00
committed by Mehdi Amini
parent 164c3c7ac5
commit 4408228269
7 changed files with 41 additions and 63 deletions

View File

@@ -32,7 +32,9 @@
#include "mlir/IR/Function.h"
#include "mlir/IR/Module.h"
#include "mlir/IR/Types.h"
#include "mlir/LLVMIR/Transforms.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Pass/PassManager.h"
#include "mlir/Target/LLVMIR.h"
#include "mlir/Transforms/Passes.h"
#include "pybind11/pybind11.h"
@@ -186,6 +188,16 @@ struct PythonMLIRModule {
PythonAttribute boolAttr(bool value);
void compile() {
PassManager manager;
manager.addPass(mlir::createCanonicalizerPass());
manager.addPass(mlir::createCSEPass());
manager.addPass(mlir::createLowerAffinePass());
manager.addPass(mlir::createConvertToLLVMIRPass());
if (failed(manager.run(module.get()))) {
llvm::errs() << "conversion to the LLVM IR dialect failed\n";
return;
}
auto created = mlir::ExecutionEngine::create(module.get());
llvm::handleAllErrors(created.takeError(),
[](const llvm::ErrorInfoBase &b) {