[clang] [CIR] Add Commutative/Idempotent traits to binary ops (PR #185163)
Henrich Lauko via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 9 10:11:54 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
----------------
xlauko wrote:
Oh true, the qustion is whether it makes sense to have them together in cir? You probably almost always want to deal with integers and floats separately.
Then there will be bunch of operations that make sense only for one of a kind (overflows, falstmath).
Also we already have special floating operations fmin, fmax, frem.
https://github.com/llvm/llvm-project/pull/185163
More information about the cfe-commits
mailing list