[llvm] IR: introduce CmpInst::PredicateSign (PR #116867)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 19 12:11:55 PST 2024


================
@@ -722,6 +722,31 @@ class CmpInst : public Instruction {
                               force_iteration_on_noniterable_enum);
   }
 
+  /// An abstraction over a floating-point predicate, and a pack of an integer
+  /// predicate with samesign information. The getPredicateSign() family of
+  /// functions in ICmpInst construct and return this type. It is also implictly
+  /// constructed with a Predicate, dropping samesign information.
+  class PredicateSign {
+    Predicate Pred;
+    std::optional<bool> HasSameSign;
----------------
artagnon wrote:

I did dabble with the idea of having the FP predicate use a false value, but I _think_ having it as an optional is useful for future development: we can add an assertions in this structure to exhaustively find the places where samesign is implicitly dropped, and exhaustively complete the samesign support throughout the codebase. Let me know if this doesn't make sense.

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


More information about the llvm-commits mailing list