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

Make it non-static, as its functionality is quite generic.
This commit is contained in:
Alan Li
2025-04-10 08:29:32 -07:00
committed by GitHub
parent 378ac572ac
commit 959b8aaeac
2 changed files with 7 additions and 4 deletions

View File

@@ -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

View File

@@ -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);