[PATCH] D94595: [Support] Simplify KnownBits::icmp helpers. NFC.

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 13 05:54:01 PST 2021


foad created this revision.
foad added a reviewer: RKSimon.
Herald added subscribers: dexonsmith, hiraditya.
foad requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Remove some special cases that aren't really any simpler than the
general case.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94595

Files:
  llvm/lib/Support/KnownBits.cpp


Index: llvm/lib/Support/KnownBits.cpp
===================================================================
--- llvm/lib/Support/KnownBits.cpp
+++ llvm/lib/Support/KnownBits.cpp
@@ -271,9 +271,6 @@
 Optional<bool> KnownBits::eq(const KnownBits &LHS, const KnownBits &RHS) {
   if (LHS.isConstant() && RHS.isConstant())
     return Optional<bool>(LHS.getConstant() == RHS.getConstant());
-  if (LHS.getMaxValue().ult(RHS.getMinValue()) ||
-      LHS.getMinValue().ugt(RHS.getMaxValue()))
-    return Optional<bool>(false);
   if (LHS.One.intersects(RHS.Zero) || RHS.One.intersects(LHS.Zero))
     return Optional<bool>(false);
   return None;
@@ -286,8 +283,6 @@
 }
 
 Optional<bool> KnownBits::ugt(const KnownBits &LHS, const KnownBits &RHS) {
-  if (LHS.isConstant() && RHS.isConstant())
-    return Optional<bool>(LHS.getConstant().ugt(RHS.getConstant()));
   // LHS >u RHS -> false if umax(LHS) <= umax(RHS)
   if (LHS.getMaxValue().ule(RHS.getMinValue()))
     return Optional<bool>(false);
@@ -312,8 +307,6 @@
 }
 
 Optional<bool> KnownBits::sgt(const KnownBits &LHS, const KnownBits &RHS) {
-  if (LHS.isConstant() && RHS.isConstant())
-    return Optional<bool>(LHS.getConstant().sgt(RHS.getConstant()));
   // LHS >s RHS -> false if smax(LHS) <= smax(RHS)
   if (LHS.getSignedMaxValue().sle(RHS.getSignedMinValue()))
     return Optional<bool>(false);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94595.316375.patch
Type: text/x-patch
Size: 1358 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210113/ff2bc249/attachment.bin>


More information about the llvm-commits mailing list