[Mlir-commits] [mlir] 959b8aa - [MLIR][NFC] Expose `computeProduct` function. (#135192)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Apr 10 08:29:35 PDT 2025


Author: Alan Li
Date: 2025-04-10T08:29:32-07:00
New Revision: 959b8aaeacfd13717b7e2cf51ecceea27fcac9a8

URL: https://github.com/llvm/llvm-project/commit/959b8aaeacfd13717b7e2cf51ecceea27fcac9a8
DIFF: https://github.com/llvm/llvm-project/commit/959b8aaeacfd13717b7e2cf51ecceea27fcac9a8.diff

LOG: [MLIR][NFC] Expose `computeProduct` function. (#135192)

Make it non-static, as its functionality is quite generic.

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Affine/IR/AffineOps.h
    mlir/lib/Dialect/Affine/IR/AffineOps.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Affine/IR/AffineOps.h b/mlir/include/mlir/Dialect/Affine/IR/AffineOps.h
index bbf38f2293448..6fdb72c370e6d 100644
--- a/mlir/include/mlir/Dialect/Affine/IR/AffineOps.h
+++ b/mlir/include/mlir/Dialect/Affine/IR/AffineOps.h
@@ -53,6 +53,11 @@ Region *getAffineScope(Operation *op);
 /// analysis scope.
 Region *getAffineAnalysisScope(Operation *op);
 
+/// Return the product of `terms`, creating an `affine.apply` if any of them are
+/// non-constant values. If any of `terms` is `nullptr`, return `nullptr`.
+OpFoldResult computeProduct(Location loc, OpBuilder &builder,
+                            ArrayRef<OpFoldResult> terms);
+
 /// AffineDmaStartOp starts a non-blocking DMA operation that transfers data
 /// from a source memref to a destination memref. The source and destination
 /// memref need not be of the same dimensionality, but need to have the same

diff  --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
index 9c5b9e82cd5e0..aa49c49062c76 100644
--- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
+++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
@@ -5081,10 +5081,8 @@ struct DropLinearizeUnitComponentsIfDisjointOrZero final
   }
 };
 
-/// Return the product of `terms`, creating an `affine.apply` if any of them are
-/// non-constant values. If any of `terms` is `nullptr`, return `nullptr`.
-static OpFoldResult computeProduct(Location loc, OpBuilder &builder,
-                                   ArrayRef<OpFoldResult> terms) {
+OpFoldResult computeProduct(Location loc, OpBuilder &builder,
+                            ArrayRef<OpFoldResult> terms) {
   int64_t nDynamic = 0;
   SmallVector<Value> dynamicPart;
   AffineExpr result = builder.getAffineConstantExpr(1);


        


More information about the Mlir-commits mailing list