[llvm] [CVP] Propagate constant range on icmp at use level (PR #73767)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 30 01:55:12 PST 2023


================
@@ -272,14 +272,29 @@ static bool processICmp(ICmpInst *Cmp, LazyValueInfo *LVI) {
       !Cmp->getOperand(0)->getType()->isIntegerTy())
     return false;
 
+  uint32_t BitWidth = Cmp->getOperand(0)->getType()->getScalarSizeInBits();
+  auto LHSRange = ConstantRange::getFull(BitWidth);
+  auto RHSRange = ConstantRange::getFull(BitWidth);
+
+  LazyValueInfo::Tristate Result =
+      LVI->getPredicateAtUse(Cmp->getPredicate(), Cmp->getOperandUse(0),
+                             Cmp->getOperandUse(1), LHSRange, RHSRange);
----------------
nikic wrote:

We should replace the call in constantFoldCmp, not add an extra one.

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


More information about the llvm-commits mailing list