aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2023-11-28 12:58:02 +0100
committerNikita Popov <npopov@redhat.com>2023-11-28 12:59:33 +0100
commit3e6207a775dfed9a8b54e4afbbffb9d6cdabf3ef (patch)
treee2b9d6eb83fcc8250fddeb98499a62c92a0a5c2c /llvm/lib/Analysis/ValueTracking.cpp
parent17041276d4c0a988da48361eb25b3271bcca8602 (diff)
downloadllvm-3e6207a775dfed9a8b54e4afbbffb9d6cdabf3ef.zip
llvm-3e6207a775dfed9a8b54e4afbbffb9d6cdabf3ef.tar.gz
llvm-3e6207a775dfed9a8b54e4afbbffb9d6cdabf3ef.tar.bz2
[InstCombine] Use SimplifyQuery for computeKnownBits() (NFC)
Call computeKnownBits() with SimplifyQuery to make sure it gets all available analyses, even if more are added in the future. As this code is performance-critical, I'm exporting the variant with by-ref KnownBits and SimplifyQuery, as the variant returning KnownBits is measurably slower in this context.
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 3e93231..7a23293 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -149,22 +149,22 @@ static void computeKnownBits(const Value *V, const APInt &DemandedElts,
KnownBits &Known, unsigned Depth,
const SimplifyQuery &Q);
-static void computeKnownBits(const Value *V, KnownBits &Known, unsigned Depth,
- const SimplifyQuery &Q) {
+void llvm::computeKnownBits(const Value *V, KnownBits &Known, unsigned Depth,
+ const SimplifyQuery &Q) {
// Since the number of lanes in a scalable vector is unknown at compile time,
// we track one bit which is implicitly broadcast to all lanes. This means
// that all lanes in a scalable vector are considered demanded.
auto *FVTy = dyn_cast<FixedVectorType>(V->getType());
APInt DemandedElts =
FVTy ? APInt::getAllOnes(FVTy->getNumElements()) : APInt(1, 1);
- computeKnownBits(V, DemandedElts, Known, Depth, Q);
+ ::computeKnownBits(V, DemandedElts, Known, Depth, Q);
}
void llvm::computeKnownBits(const Value *V, KnownBits &Known,
const DataLayout &DL, unsigned Depth,
AssumptionCache *AC, const Instruction *CxtI,
const DominatorTree *DT, bool UseInstrInfo) {
- ::computeKnownBits(
+ computeKnownBits(
V, Known, Depth,
SimplifyQuery(DL, DT, AC, safeCxtI(V, CxtI), UseInstrInfo));
}
@@ -1724,7 +1724,7 @@ KnownBits llvm::computeKnownBits(const Value *V, const APInt &DemandedElts,
KnownBits llvm::computeKnownBits(const Value *V, unsigned Depth,
const SimplifyQuery &Q) {
KnownBits Known(getBitWidth(V->getType(), Q.DL));
- ::computeKnownBits(V, Known, Depth, Q);
+ computeKnownBits(V, Known, Depth, Q);
return Known;
}