[llvm] 4f7e034 - [ValueTracking] Check non-zero operator before dominating condition (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 21 06:56:49 PDT 2023
Author: Nikita Popov
Date: 2023-07-21T15:56:41+02:00
New Revision: 4f7e03463f34343bc4873a4c95470c22ad9888af
URL: https://github.com/llvm/llvm-project/commit/4f7e03463f34343bc4873a4c95470c22ad9888af
DIFF: https://github.com/llvm/llvm-project/commit/4f7e03463f34343bc4873a4c95470c22ad9888af.diff
LOG: [ValueTracking] Check non-zero operator before dominating condition (NFC)
Prefer checking for non-zero operator before non-zero via
dominating conditions. This is to make sure we don't have
compile-time regressions when special cases that are currently
part of isKnownNonZero() get moved into isKnownNonZeroFromOperator().
Added:
Modified:
llvm/lib/Analysis/ValueTracking.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 62f7c542a11316..3dd51165b361dd 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -2856,13 +2856,14 @@ bool isKnownNonZero(const Value *V, const APInt &DemandedElts, unsigned Depth,
}
}
+ if (const auto *I = dyn_cast<Operator>(V))
+ if (isKnownNonZeroFromOperator(I, DemandedElts, Depth, Q))
+ return true;
+
if (!isa<Constant>(V) &&
isKnownNonNullFromDominatingCondition(V, Q.CxtI, Q.DT))
return true;
- if (const auto *I = dyn_cast<Operator>(V))
- return isKnownNonZeroFromOperator(I, DemandedElts, Depth, Q);
-
return false;
}
More information about the llvm-commits
mailing list