[llvm] d1e2305 - [ValueTracking] Fix release build
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 19 08:07:25 PDT 2024
Author: Nikita Popov
Date: 2024-03-19T16:07:14+01:00
New Revision: d1e2305a6d70bbf565104644a4594cbf4f78e6ac
URL: https://github.com/llvm/llvm-project/commit/d1e2305a6d70bbf565104644a4594cbf4f78e6ac
DIFF: https://github.com/llvm/llvm-project/commit/d1e2305a6d70bbf565104644a4594cbf4f78e6ac.diff
LOG: [ValueTracking] Fix release build
Move the declaration of the Ty variable outside the NDEBUG guard
and make use of it in the remainder of the function.
Added:
Modified:
llvm/lib/Analysis/ValueTracking.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index bf6afad3636b4a..70c87cb86e997a 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -2863,9 +2863,9 @@ static bool isKnownNonZeroFromOperator(const Operator *I,
/// Supports values with integer or pointer type and vectors of integers.
bool isKnownNonZero(const Value *V, const APInt &DemandedElts, unsigned Depth,
const SimplifyQuery &Q) {
+ Type *Ty = V->getType();
#ifndef NDEBUG
- Type *Ty = V->getType();
assert(Depth <= MaxAnalysisRecursionDepth && "Limit Search Depth");
if (auto *FVTy = dyn_cast<FixedVectorType>(Ty)) {
@@ -2887,7 +2887,7 @@ bool isKnownNonZero(const Value *V, const APInt &DemandedElts, unsigned Depth,
// For constant vectors, check that all elements are undefined or known
// non-zero to determine that the whole vector is known non-zero.
- if (auto *VecTy = dyn_cast<FixedVectorType>(C->getType())) {
+ if (auto *VecTy = dyn_cast<FixedVectorType>(Ty)) {
for (unsigned i = 0, e = VecTy->getNumElements(); i != e; ++i) {
if (!DemandedElts[i])
continue;
@@ -2918,7 +2918,7 @@ bool isKnownNonZero(const Value *V, const APInt &DemandedElts, unsigned Depth,
if (MDNode *Ranges = Q.IIQ.getMetadata(I, LLVMContext::MD_range)) {
// If the possible ranges don't contain zero, then the value is
// definitely non-zero.
- assert(V->getType()->isIntOrIntVectorTy() && "Range on non-integer?");
+ assert(Ty->isIntOrIntVectorTy() && "Range on non-integer?");
const APInt ZeroValue(Ty->getScalarSizeInBits(), 0);
if (rangeMetadataExcludesValue(Ranges, ZeroValue))
return true;
@@ -2934,7 +2934,7 @@ bool isKnownNonZero(const Value *V, const APInt &DemandedElts, unsigned Depth,
// Check for pointer simplifications.
- if (PointerType *PtrTy = dyn_cast<PointerType>(V->getType())) {
+ if (PointerType *PtrTy = dyn_cast<PointerType>(Ty)) {
// A byval, inalloca may not be null in a non-default addres space. A
// nonnull argument is assumed never 0.
if (const Argument *A = dyn_cast<Argument>(V)) {
More information about the llvm-commits
mailing list