[ValueTracking] Replace an always false condition with an assert. NFC
authorCraig Topper <craig.topper@sifive.com>
Thu, 9 Feb 2023 23:19:18 +0000 (15:19 -0800)
committerCraig Topper <craig.topper@sifive.com>
Thu, 9 Feb 2023 23:19:28 +0000 (15:19 -0800)
The one caller of this function already checked that V isn't a
Constant.

Alternatively, we could remove the check from the caller if reviewers
prefer.

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D143677

llvm/lib/Analysis/ValueTracking.cpp

index c86a70c..05b802c 100644 (file)
@@ -2302,8 +2302,7 @@ static bool isGEPKnownNonNull(const GEPOperator *GEP, unsigned Depth,
 static bool isKnownNonNullFromDominatingCondition(const Value *V,
                                                   const Instruction *CtxI,
                                                   const DominatorTree *DT) {
-  if (isa<Constant>(V))
-    return false;
+  assert(!isa<Constant>(V) && "Called for constant?");
 
   if (!CtxI || !DT)
     return false;