[llvm] [InstCombine] Create a class to lazily track computed known bits (PR #66611)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 16 09:59:05 PDT 2023


================
@@ -6256,10 +6252,11 @@ static OverflowResult mapOverflowResult(ConstantRange::OverflowResult OR) {
 
 /// Combine constant ranges from computeConstantRange() and computeKnownBits().
 static ConstantRange
-computeConstantRangeIncludingKnownBits(const Value *V, bool ForSigned,
+computeConstantRangeIncludingKnownBits(const WithCache<const Value *> &V,
+                                       bool ForSigned,
                                        const SimplifyQuery &SQ) {
-  KnownBits Known = ::computeKnownBits(V, /*Depth=*/0, SQ);
-  ConstantRange CR1 = ConstantRange::fromKnownBits(Known, ForSigned);
+  ConstantRange CR1 =
+      ConstantRange::fromKnownBits(V.getKnownBits(SQ), ForSigned);
----------------
goldsteinn wrote:

Would still personally be in favor of making `getCR` an API of its own. But not particularly important.

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


More information about the llvm-commits mailing list