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

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 7 14:54:23 PDT 2024


================
@@ -1033,6 +1033,28 @@ class CmpInst : public Instruction {
   }
 };
 
+/// 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.
+class PossiblySameSignInst : public CmpInst {
----------------
elhewaty wrote:

> I'd prefer to add hasSameSign/setSameSame directly to ICmpInst, instead of having the PossiblySameSignInst wrapper.

@nikic  Is there a specific reason for this?

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


More information about the llvm-commits mailing list