[clang] [CIR] Use declarative TableGen constraints for overflow flag verification (PR #195476)
Henrich Lauko via cfe-commits
cfe-commits at lists.llvm.org
Tue May 5 22:54:25 PDT 2026
================
@@ -2366,34 +2379,47 @@ class CIR_BinaryOp<string mnemonic, Type type, list<Trait> traits = []>
}];
}
-// Base class for binary ops that support integer overflow flags (nsw/nuw)
-// and saturated arithmetic.
-class CIR_BinaryOpWithOverflowFlags<string mnemonic, Type type,
- list<Trait> traits = []>
- : CIR_BinaryOp<mnemonic, type, !listconcat([Pure], traits)>
+// Base class for binary ops that support integer overflow flags (nsw/nuw).
+class CIR_BinaryOpWithOverflowFlags<string mnemonic, Type type>
+ : CIR_BinaryOp<mnemonic, type>
{
- let arguments = (ins
- type:$lhs, type:$rhs,
+ let append traits = [Pure, NSWFlagIntOnly, NUWFlagIntOnly];
----------------
xlauko wrote:
Still open question whether we want to keep binary ops for integers and floats together?
I am not sure whether there is even a usecase where you don't care whether it is floating/integer operation?
And most of the flags are disjinctive on these two sets of operations, e.g. overflow flags for ints, fast-math and such for floats?
What do you think about proper direction?
https://github.com/llvm/llvm-project/pull/195476
More information about the cfe-commits
mailing list