[Mlir-commits] [mlir] [mlir] Add helper to check elementwise-mappable ops with tensors and scalars (PR #154872)

Adam Siemieniuk llvmlistbot at llvm.org
Mon Aug 25 03:12:20 PDT 2025


================
@@ -20,13 +20,37 @@ namespace mlir {
 
 using namespace mlir;
 
+// Treats primitive scalars and 0-D tensors as "scalar-like" for broadcasting.
+static inline bool isScalarLike(Type t) {
+  if (llvm::isa<IntegerType, FloatType, IndexType, ComplexType>(t))
----------------
adam-smnk wrote:

nit: you can drop `llvm::` from `isa`
mlir has these in its namespace as well

https://github.com/llvm/llvm-project/pull/154872


More information about the Mlir-commits mailing list