mirror of
https://github.com/zama-ai/concrete.git
synced 2026-04-17 03:00:54 -04:00
fix(compiler): do not optimize llvm twice
This commit is contained in:
@@ -148,6 +148,7 @@ llvm::Error emitObject(llvm::Module &module, string objectPath) {
|
||||
// https://llvm.org/docs/NewPassManager.html#status-of-the-new-and-legacy-pass-managers
|
||||
llvm::legacy::PassManager pm;
|
||||
auto FileType = llvm::CGFT_ObjectFile;
|
||||
targetMachine->setOptLevel(llvm::CodeGenOpt::Level::Aggressive);
|
||||
if (targetMachine->addPassesToEmitFile(pm, objectFile->os(), nullptr,
|
||||
FileType, false)) {
|
||||
return StreamStringError("TheTargetMachine can't emit object file");
|
||||
|
||||
@@ -527,8 +527,10 @@ lowerLLVMDialectToLLVMIR(mlir::MLIRContext &context,
|
||||
|
||||
mlir::LogicalResult optimizeLLVMModule(llvm::LLVMContext &llvmContext,
|
||||
llvm::Module &module) {
|
||||
// -O3 is done LLVMEmitFile.cpp
|
||||
auto optLevel = llvm::CodeGenOpt::None;
|
||||
std::function<llvm::Error(llvm::Module *)> optPipeline =
|
||||
mlir::makeOptimizingTransformer(3, 0, nullptr);
|
||||
mlir::makeOptimizingTransformer(optLevel, 0, nullptr);
|
||||
|
||||
if (optPipeline(&module))
|
||||
return mlir::failure();
|
||||
|
||||
Reference in New Issue
Block a user