[llvm] [InstCombine] Create a class to lazily track computed known bits (PR #66611)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 16 10:13:41 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);
----------------
nikic wrote:
If we add a getConstantRange API on this class, then what it would have to return is a cached version of computeConstantRange(), not ConstantRange::fromKnownBits(). That's something we could evaluate, but not as part of this PR. I don't think it would be worthwhile right now.
https://github.com/llvm/llvm-project/pull/66611
More information about the llvm-commits
mailing list