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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 13 12:02:20 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.
----------------
nikic wrote:

```suggestion
  /// "slt" to "ult" and vice versa, which enables more optimizations.
```
I'd also move this comment to hasSameSign(), which is the public API.

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


More information about the llvm-commits mailing list