[llvm] [ValueTracking] Take into account whether zero is poison when computing CR for `ct{t,l}z` (PR #122548)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 11 01:04:47 PST 2025


================
@@ -9898,13 +9898,20 @@ static void setLimitsForBinOp(const BinaryOperator &BO, APInt &Lower,
   }
 }
 
-static ConstantRange getRangeForIntrinsic(const IntrinsicInst &II) {
+static ConstantRange getRangeForIntrinsic(const IntrinsicInst &II,
+                                          bool UseInstrInfo) {
   unsigned Width = II.getType()->getScalarSizeInBits();
   const APInt *C;
   switch (II.getIntrinsicID()) {
-  case Intrinsic::ctpop:
   case Intrinsic::ctlz:
-  case Intrinsic::cttz:
+  case Intrinsic::cttz: {
+    APInt Upper = APInt(Width, Width);
----------------
nikic wrote:

```suggestion
    APInt Upper(Width, Width);
```

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


More information about the llvm-commits mailing list