[llvm] InstSimplify: teach simplifyICmpWithConstant about samesign (PR #125899)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 6 08:28:09 PST 2025


================
@@ -99,8 +100,10 @@ class [[nodiscard]] ConstantRange {
   /// answer is not representable as a ConstantRange, the return value will be a
   /// proper superset of the above.
   ///
+  /// Note that we respect samesign information on the icmp.
+  ///
   /// Example: Pred = ult and Other = i8 [2, 5) returns Result = [0, 4)
-  static ConstantRange makeAllowedICmpRegion(CmpInst::Predicate Pred,
+  static ConstantRange makeAllowedICmpRegion(CmpPredicate Pred,
----------------
nikic wrote:

It would be nice to have exhaustive test coverage for this in ConstantRangeTest. It looks like it's currently nearly untested :(

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


More information about the llvm-commits mailing list