diff --git mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp index c046ea1b824f..938d7cb9a200 100644 --- mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp +++ mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp @@ -787,7 +787,6 @@ struct ConvertFuncToLLVMPass // TODO(https://github.com/llvm/llvm-project/issues/70982): Remove these in // favor of their dedicated conversion passes. - arith::populateArithToLLVMConversionPatterns(typeConverter, patterns); cf::populateControlFlowToLLVMConversionPatterns(typeConverter, patterns); LLVMConversionTarget target(getContext()); diff --git mlir/test/Dialect/ArmSVE/legalize-for-llvm.mlir mlir/test/Dialect/ArmSVE/legalize-for-llvm.mlir index 31d5376c32d9..bdb69a95a52d 100644 --- mlir/test/Dialect/ArmSVE/legalize-for-llvm.mlir +++ mlir/test/Dialect/ArmSVE/legalize-for-llvm.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -convert-vector-to-llvm="enable-arm-sve" -convert-func-to-llvm -cse -reconcile-unrealized-casts -split-input-file %s | FileCheck %s +// RUN: mlir-opt -convert-vector-to-llvm="enable-arm-sve" -convert-func-to-llvm -convert-arith-to-llvm -cse -reconcile-unrealized-casts -split-input-file %s | FileCheck %s func.func @arm_sve_sdot(%a: vector<[16]xi8>, %b: vector<[16]xi8>, diff --git mlir/test/lib/Dialect/LLVM/TestLowerToLLVM.cpp mlir/test/lib/Dialect/LLVM/TestLowerToLLVM.cpp index 10c21612f64a..b9033df7fe2b 100644 --- mlir/test/lib/Dialect/LLVM/TestLowerToLLVM.cpp +++ mlir/test/lib/Dialect/LLVM/TestLowerToLLVM.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "mlir/Conversion/AffineToStandard/AffineToStandard.h" +#include "mlir/Conversion/ArithToLLVM/ArithToLLVM.h" #include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVMPass.h" #include "mlir/Conversion/IndexToLLVM/IndexToLLVM.h" #include "mlir/Conversion/MathToLLVM/MathToLLVM.h" @@ -73,6 +74,8 @@ void buildTestLowerToLLVM(OpPassManager &pm, pm.addPass(createFinalizeMemRefToLLVMConversionPass()); // Convert Func to LLVM (always needed). pm.addPass(createConvertFuncToLLVMPass()); + // Convert Arith to LLVM (always needed). + pm.addPass(createArithToLLVMConversionPass()); // Convert Index to LLVM (always needed). pm.addPass(createConvertIndexToLLVMPass()); // Convert remaining unrealized_casts (always needed). diff --git mlir/test/mlir-cpu-runner/math-polynomial-approx.mlir mlir/test/mlir-cpu-runner/math-polynomial-approx.mlir index b8861198d596..bfd570658099 100644 --- mlir/test/mlir-cpu-runner/math-polynomial-approx.mlir +++ mlir/test/mlir-cpu-runner/math-polynomial-approx.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -pass-pipeline="builtin.module(func.func(test-math-polynomial-approximation,convert-arith-to-llvm),convert-vector-to-scf,convert-scf-to-cf,convert-cf-to-llvm,convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)" \ +// RUN: mlir-opt %s -pass-pipeline="builtin.module(func.func(test-math-polynomial-approximation),convert-vector-to-scf,convert-scf-to-cf,convert-vector-to-llvm,convert-to-llvm,reconcile-unrealized-casts)" \ // RUN: | mlir-cpu-runner \ // RUN: -e main -entry-point-result=void -O0 \ // RUN: -shared-libs=%mlir_c_runner_utils \ diff --git mlir/test/mlir-cpu-runner/test-expand-math-approx.mlir mlir/test/mlir-cpu-runner/test-expand-math-approx.mlir index 93de767b5517..140b5f43d5eb 100644 --- mlir/test/mlir-cpu-runner/test-expand-math-approx.mlir +++ mlir/test/mlir-cpu-runner/test-expand-math-approx.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -pass-pipeline="builtin.module(func.func(test-expand-math,convert-arith-to-llvm),convert-vector-to-scf,convert-scf-to-cf,convert-cf-to-llvm,convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)" \ +// RUN: mlir-opt %s -pass-pipeline="builtin.module(func.func(test-expand-math),convert-vector-to-scf,convert-scf-to-cf,convert-vector-to-llvm,convert-to-llvm,reconcile-unrealized-casts)" \ // RUN: | mlir-cpu-runner \ // RUN: -e main -entry-point-result=void -O0 \ // RUN: -shared-libs=%mlir_c_runner_utils \ diff --git mlir/test/python/execution_engine.py mlir/test/python/execution_engine.py index 7c375ce81de0..e085bc6d4c8b 100644 --- mlir/test/python/execution_engine.py +++ mlir/test/python/execution_engine.py @@ -74,7 +74,7 @@ run(testInvalidModule) def lowerToLLVM(module): pm = PassManager.parse( - "builtin.module(convert-complex-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts)" + "builtin.module(convert-complex-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,convert-arith-to-llvm,reconcile-unrealized-casts)" ) pm.run(module.operation) return module diff --git mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp index eab64c97e89e..7c6ec481979f 100644 --- mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp +++ mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#include "mlir/Conversion/ArithToLLVM/ArithToLLVM.h" #include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVMPass.h" #include "mlir/Conversion/GPUToVulkan/ConvertGPUToVulkanPass.h" #include "mlir/Conversion/LLVMCommon/LoweringOptions.h" @@ -55,6 +56,7 @@ static LogicalResult runMLIRPasses(Operation *op, JitRunnerOptions &) { funcToLLVMOptions.indexBitwidth = DataLayout(module).getTypeSizeInBits(IndexType::get(module.getContext())); passManager.addPass(createConvertFuncToLLVMPass(funcToLLVMOptions)); + passManager.addPass(createArithToLLVMConversionPass()); passManager.addPass(createReconcileUnrealizedCastsPass()); passManager.addPass(createConvertVulkanLaunchFuncToVulkanCallsPass());