[llvm] [LVI] Learn value ranges from ctpop results (PR #121945)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 13 07:40:48 PST 2025


================
@@ -1159,6 +1159,28 @@ getRangeViaSLT(CmpInst::Predicate Pred, APInt RHS,
   return std::nullopt;
 }
 
+/// Get value range for a "ctpop(Val) Pred RHS" condition.
+static ValueLatticeElement getValueFromICmpCtpop(ICmpInst::Predicate Pred,
+                                                 Value *RHS) {
+  unsigned BitWidth = RHS->getType()->getPrimitiveSizeInBits();
----------------
nikic wrote:

```suggestion
  unsigned BitWidth = RHS->getType()->getScalarSizeInBits();
```

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


More information about the llvm-commits mailing list