[llvm] [ValueTracking] Use `ConstantRange::toKnownBits` when computing from Range Metadata; NFC (PR #85574)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 22 06:10:41 PDT 2024


================
@@ -423,24 +423,17 @@ void llvm::computeKnownBitsFromRangeMetadata(const MDNode &Ranges,
   unsigned NumRanges = Ranges.getNumOperands() / 2;
   assert(NumRanges >= 1);
 
-  Known.Zero.setAllBits();
-  Known.One.setAllBits();
+  ConstantRange CR = ConstantRange::getFull(BitWidth);
----------------
dtcxzyw wrote:

```suggestion
  ConstantRange CR = ConstantRange::getEmpty(BitWidth);
```

It should be initialized to empty :)


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


More information about the llvm-commits mailing list