[llvm] [IR] Add `samesign` flag to icmp instruction (PR #111419)

Thorsten Schütt via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 14 10:29:38 PDT 2024


================
@@ -1224,6 +1224,17 @@ class ICmpInst: public CmpInst {
   /// Return the unsigned version of the predicate.
   static Predicate getUnsignedPredicate(Predicate pred);
 
+  /// An icmp instruction, which can be marked as "samesign", indicating that
+  /// the two operands have the same sign. This means that we can convert
+  /// "slt/ult" to "ult", which enables more optimizations.
+  enum { SameSign = (1 << 0) };
----------------
tschuett wrote:

Do we need the `enum` or can this be `constexpr unsigned SameSigm = 1 << 0;` ?

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


More information about the llvm-commits mailing list