[clang] [CIR] Add Commutative/Idempotent traits to binary ops (PR #185163)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 9 09:55:46 PDT 2026
================
@@ -2186,7 +2186,9 @@ class CIR_BinaryOpWithOverflowFlags<string mnemonic, Type type,
// AddOp
//===----------------------------------------------------------------------===//
-def CIR_AddOp : CIR_BinaryOpWithOverflowFlags<"add", CIR_AnyArithType> {
+def CIR_AddOp : CIR_BinaryOpWithOverflowFlags<"add", CIR_AnyArithType, [
+ Commutative
----------------
andykaylor wrote:
The add and multiply operations shouldn't be commutative when used with a floating-point type. I see that the LLVM dialect has separate operations for integer and floating-point add, and only the integer add has the commutative trait.
https://github.com/llvm/llvm-project/pull/185163
More information about the cfe-commits
mailing list