[clang] [CIR] Split cir.binop into separate per-operation binary ops (PR #184227)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 3 09:02:55 PST 2026


================
@@ -56,6 +56,8 @@ constexpr OverflowBehavior &operator&=(OverflowBehavior &a,
   return a;
 }
 
+constexpr bool any(OverflowBehavior ob) { return ob != OverflowBehavior::None; }
----------------
andykaylor wrote:

This is definitely cleaner than the old code, but what would you think about a function that tests a specified flag? So rather than

`op.setNoUnsignedWrap(any(ob & OverflowBehavior::NoUnsignedWrap));`

you'd have

`op.setNoUnsignedWrap(testFlag(ob, OverflowBehavior::NoUnsignedWrap));`

Obviously this is minor and could be a future change if you think it's a good idea.

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


More information about the cfe-commits mailing list