[Mlir-commits] [flang] [llvm] [mlir] [mlir][Arith] Rename Conversion/ArithCommon to ArithAttrToLLVM. NFC (PR #231743)

Fangrui Song llvmlistbot at llvm.org
Wed Oct 14 10:01:01 PDT 2026


https://github.com/MaskRay updated https://github.com/llvm/llvm-project/pull/231743

>From c63ecf2f3fe73875512ce168852bf6d3c513c7ab Mon Sep 17 00:00:00 2001
From: Fangrui Song <i at maskray.me>
Date: Tue, 13 Oct 2026 20:59:16 -0700
Subject: [PATCH 1/2] [mlir][Arith] Rename Conversion/ArithCommon to
 ArithAttrToLLVM. NFC

The directory holds only MLIRArithAttrToLLVMConversion. Rename it to
match the library and free ArithCommon for code shared by Arith
conversions.

LLM-aided
---
 flang/lib/Optimizer/CodeGen/CodeGen.cpp                     | 2 +-
 .../{ArithCommon => ArithAttrToLLVM}/AttrToLLVMConverter.h  | 6 +++---
 .../AttrToLLVMConverter.cpp                                 | 2 +-
 .../{ArithCommon => ArithAttrToLLVM}/CMakeLists.txt         | 0
 mlir/lib/Conversion/ArithToLLVM/ArithToLLVM.cpp             | 2 +-
 mlir/lib/Conversion/CMakeLists.txt                          | 2 +-
 mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp         | 2 +-
 mlir/lib/Conversion/MathToLLVM/MathToLLVM.cpp               | 2 +-
 mlir/lib/Conversion/MathToXeVM/MathToXeVM.cpp               | 2 +-
 mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp    | 2 +-
 utils/bazel/llvm-project-overlay/mlir/BUILD.bazel           | 4 ++--
 11 files changed, 13 insertions(+), 13 deletions(-)
 rename mlir/include/mlir/Conversion/{ArithCommon => ArithAttrToLLVM}/AttrToLLVMConverter.h (97%)
 rename mlir/lib/Conversion/{ArithCommon => ArithAttrToLLVM}/AttrToLLVMConverter.cpp (98%)
 rename mlir/lib/Conversion/{ArithCommon => ArithAttrToLLVM}/CMakeLists.txt (100%)

diff --git a/flang/lib/Optimizer/CodeGen/CodeGen.cpp b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
index b59996a9491e46..d72b1fb4a1d783 100644
--- a/flang/lib/Optimizer/CodeGen/CodeGen.cpp
+++ b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
@@ -33,7 +33,7 @@
 #include "flang/Runtime/allocator-registry-consts.h"
 #include "flang/Runtime/descriptor-consts.h"
 #include "flang/Semantics/runtime-type-info.h"
-#include "mlir/Conversion/ArithCommon/AttrToLLVMConverter.h"
+#include "mlir/Conversion/ArithAttrToLLVM/AttrToLLVMConverter.h"
 #include "mlir/Conversion/ArithToLLVM/ArithToLLVM.h"
 #include "mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h"
 #include "mlir/Conversion/ComplexToROCDLLibraryCalls/ComplexToROCDLLibraryCalls.h"
diff --git a/mlir/include/mlir/Conversion/ArithCommon/AttrToLLVMConverter.h b/mlir/include/mlir/Conversion/ArithAttrToLLVM/AttrToLLVMConverter.h
similarity index 97%
rename from mlir/include/mlir/Conversion/ArithCommon/AttrToLLVMConverter.h
rename to mlir/include/mlir/Conversion/ArithAttrToLLVM/AttrToLLVMConverter.h
index 23a4ef863b5320..16985c1912ad56 100644
--- a/mlir/include/mlir/Conversion/ArithCommon/AttrToLLVMConverter.h
+++ b/mlir/include/mlir/Conversion/ArithAttrToLLVM/AttrToLLVMConverter.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef MLIR_CONVERSION_ARITHCOMMON_ATTRTOLLVMCONVERTER_H
-#define MLIR_CONVERSION_ARITHCOMMON_ATTRTOLLVMCONVERTER_H
+#ifndef MLIR_CONVERSION_ARITHATTRTOLLVM_ATTRTOLLVMCONVERTER_H
+#define MLIR_CONVERSION_ARITHATTRTOLLVM_ATTRTOLLVMCONVERTER_H
 
 #include "mlir/Dialect/Arith/IR/ArithAttributes.h"
 #include "mlir/Dialect/LLVMIR/LLVMDialect.h"
@@ -177,4 +177,4 @@ class AttrConverterConstrainedFPToLLVM {
 } // namespace arith
 } // namespace mlir
 
-#endif // MLIR_CONVERSION_ARITHCOMMON_ATTRTOLLVMCONVERTER_H
+#endif // MLIR_CONVERSION_ARITHATTRTOLLVM_ATTRTOLLVMCONVERTER_H
diff --git a/mlir/lib/Conversion/ArithCommon/AttrToLLVMConverter.cpp b/mlir/lib/Conversion/ArithAttrToLLVM/AttrToLLVMConverter.cpp
similarity index 98%
rename from mlir/lib/Conversion/ArithCommon/AttrToLLVMConverter.cpp
rename to mlir/lib/Conversion/ArithAttrToLLVM/AttrToLLVMConverter.cpp
index cf60a048f782c6..01b586e815ff9b 100644
--- a/mlir/lib/Conversion/ArithCommon/AttrToLLVMConverter.cpp
+++ b/mlir/lib/Conversion/ArithAttrToLLVM/AttrToLLVMConverter.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "mlir/Conversion/ArithCommon/AttrToLLVMConverter.h"
+#include "mlir/Conversion/ArithAttrToLLVM/AttrToLLVMConverter.h"
 
 using namespace mlir;
 
diff --git a/mlir/lib/Conversion/ArithCommon/CMakeLists.txt b/mlir/lib/Conversion/ArithAttrToLLVM/CMakeLists.txt
similarity index 100%
rename from mlir/lib/Conversion/ArithCommon/CMakeLists.txt
rename to mlir/lib/Conversion/ArithAttrToLLVM/CMakeLists.txt
diff --git a/mlir/lib/Conversion/ArithToLLVM/ArithToLLVM.cpp b/mlir/lib/Conversion/ArithToLLVM/ArithToLLVM.cpp
index e61374cfcfda90..f5acfd8ee89a9d 100644
--- a/mlir/lib/Conversion/ArithToLLVM/ArithToLLVM.cpp
+++ b/mlir/lib/Conversion/ArithToLLVM/ArithToLLVM.cpp
@@ -9,7 +9,7 @@
 #include "mlir/Conversion/ArithToLLVM/ArithToLLVM.h"
 
 #include "mlir/Analysis/DataLayoutAnalysis.h"
-#include "mlir/Conversion/ArithCommon/AttrToLLVMConverter.h"
+#include "mlir/Conversion/ArithAttrToLLVM/AttrToLLVMConverter.h"
 #include "mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h"
 #include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
 #include "mlir/Conversion/LLVMCommon/VectorPattern.h"
diff --git a/mlir/lib/Conversion/CMakeLists.txt b/mlir/lib/Conversion/CMakeLists.txt
index cee1a069ad3b1d..ae14be694f89fe 100644
--- a/mlir/lib/Conversion/CMakeLists.txt
+++ b/mlir/lib/Conversion/CMakeLists.txt
@@ -1,6 +1,6 @@
 add_subdirectory(AffineToStandard)
 add_subdirectory(AMDGPUToROCDL)
-add_subdirectory(ArithCommon)
+add_subdirectory(ArithAttrToLLVM)
 add_subdirectory(ArithToAMDGPU)
 add_subdirectory(ArithAndMathToAPFloat)
 add_subdirectory(ArithToArmSME)
diff --git a/mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp b/mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp
index cbe5820300f82e..94a07ad12bae3c 100644
--- a/mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp
+++ b/mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp
@@ -8,7 +8,7 @@
 
 #include "mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h"
 
-#include "mlir/Conversion/ArithCommon/AttrToLLVMConverter.h"
+#include "mlir/Conversion/ArithAttrToLLVM/AttrToLLVMConverter.h"
 #include "mlir/Conversion/ComplexCommon/DivisionConverter.h"
 #include "mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h"
 #include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
diff --git a/mlir/lib/Conversion/MathToLLVM/MathToLLVM.cpp b/mlir/lib/Conversion/MathToLLVM/MathToLLVM.cpp
index ca7888a9aec767..17436cfe65c131 100644
--- a/mlir/lib/Conversion/MathToLLVM/MathToLLVM.cpp
+++ b/mlir/lib/Conversion/MathToLLVM/MathToLLVM.cpp
@@ -8,7 +8,7 @@
 
 #include "mlir/Conversion/MathToLLVM/MathToLLVM.h"
 
-#include "mlir/Conversion/ArithCommon/AttrToLLVMConverter.h"
+#include "mlir/Conversion/ArithAttrToLLVM/AttrToLLVMConverter.h"
 #include "mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h"
 #include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
 #include "mlir/Conversion/LLVMCommon/Pattern.h"
diff --git a/mlir/lib/Conversion/MathToXeVM/MathToXeVM.cpp b/mlir/lib/Conversion/MathToXeVM/MathToXeVM.cpp
index bf63d6f118f67e..55d7076163d404 100644
--- a/mlir/lib/Conversion/MathToXeVM/MathToXeVM.cpp
+++ b/mlir/lib/Conversion/MathToXeVM/MathToXeVM.cpp
@@ -8,7 +8,7 @@
 
 #include "mlir/Conversion/MathToXeVM/MathToXeVM.h"
 #include "mlir/Analysis/DataLayoutAnalysis.h"
-#include "mlir/Conversion/ArithCommon/AttrToLLVMConverter.h"
+#include "mlir/Conversion/ArithAttrToLLVM/AttrToLLVMConverter.h"
 #include "mlir/Dialect/Arith/IR/Arith.h"
 #include "mlir/Dialect/LLVMIR/FunctionCallUtils.h"
 #include "mlir/Dialect/LLVMIR/LLVMDialect.h"
diff --git a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
index f28d163825feea..25646ec8477444 100644
--- a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
+++ b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
@@ -8,7 +8,7 @@
 
 #include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h"
 
-#include "mlir/Conversion/ArithCommon/AttrToLLVMConverter.h"
+#include "mlir/Conversion/ArithAttrToLLVM/AttrToLLVMConverter.h"
 #include "mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h"
 #include "mlir/Conversion/LLVMCommon/PrintCallHelper.h"
 #include "mlir/Conversion/LLVMCommon/TypeConverter.h"
diff --git a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
index 3f489ae43d54e3..a0a21831b32865 100644
--- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
@@ -8860,8 +8860,8 @@ cc_library(
 
 cc_library(
     name = "ArithAttrToLLVMConversion",
-    srcs = glob(["lib/Conversion/ArithCommon/*.cpp"]),
-    hdrs = glob(["include/mlir/Conversion/ArithCommon/*.h"]),
+    srcs = glob(["lib/Conversion/ArithAttrToLLVM/*.cpp"]),
+    hdrs = glob(["include/mlir/Conversion/ArithAttrToLLVM/*.h"]),
     includes = ["include"],
     deps = [
         ":ArithDialect",

>From 1f99b050a09aee209b8987cfa4d1cb43c825ad34 Mon Sep 17 00:00:00 2001
From: Fangrui Song <i at maskray.me>
Date: Wed, 14 Oct 2026 10:00:46 -0700
Subject: [PATCH 2/2] clang-format

---
 .../mlir/Conversion/ArithAttrToLLVM/AttrToLLVMConverter.h       | 2 --
 1 file changed, 2 deletions(-)

diff --git a/mlir/include/mlir/Conversion/ArithAttrToLLVM/AttrToLLVMConverter.h b/mlir/include/mlir/Conversion/ArithAttrToLLVM/AttrToLLVMConverter.h
index 16985c1912ad56..3e103fb8a796f7 100644
--- a/mlir/include/mlir/Conversion/ArithAttrToLLVM/AttrToLLVMConverter.h
+++ b/mlir/include/mlir/Conversion/ArithAttrToLLVM/AttrToLLVMConverter.h
@@ -18,7 +18,6 @@
 
 namespace mlir {
 namespace arith {
-
 /// Maps arithmetic fastmath enum values to LLVM enum values.
 LLVM::FastmathFlags
 convertArithFastMathFlagsToLLVM(arith::FastMathFlags arithFMF);
@@ -173,7 +172,6 @@ class AttrConverterConstrainedFPToLLVM {
 private:
   NamedAttrList convertedAttr;
 };
-
 } // namespace arith
 } // namespace mlir
 



More information about the Mlir-commits mailing list