[Mlir-commits] [mlir] [mlir][complex] Make complex MulOp commutative (PR #215257)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Aug 10 05:04:04 PDT 2026


https://github.com/matteo-rm created https://github.com/llvm/llvm-project/pull/215257

This PR makes complex multiplication commutative. This is consistent with Arith's MulFOp, and Complex addition also being commutative.

>From d74fefa4c83a5d6be4069f5f95d325a2cb1ae77a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Matt=C3=A9o=20Rizza=20Murgier?=
 <matteo.rizza-murgier at sipearl.com>
Date: Tue, 28 Jul 2026 14:53:53 +0200
Subject: [PATCH] [mlir][complex] Make complex MulOp commutative

---
 mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td b/mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td
index 828379ded14b3..9a5140a28c388 100644
--- a/mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td
+++ b/mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td
@@ -367,7 +367,7 @@ def Log1pOp : ComplexUnaryOp<"log1p", [SameOperandsAndResultType]> {
 // MulOp
 //===----------------------------------------------------------------------===//
 
-def MulOp : ComplexArithmeticOp<"mul"> {
+def MulOp : ComplexArithmeticOp<"mul", [Commutative]> {
   let summary = "complex multiplication";
   let description = [{
     The `mul` operation takes two complex numbers and returns their product:



More information about the Mlir-commits mailing list