[llvm] 68c9068 - [ValueTracking] Replace an always false condition with an assert. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 9 15:19:37 PST 2023


Author: Craig Topper
Date: 2023-02-09T15:19:28-08:00
New Revision: 68c906811bcb1edfc1a4c73e0fcadb51f7f3e8e3

URL: https://github.com/llvm/llvm-project/commit/68c906811bcb1edfc1a4c73e0fcadb51f7f3e8e3
DIFF: https://github.com/llvm/llvm-project/commit/68c906811bcb1edfc1a4c73e0fcadb51f7f3e8e3.diff

LOG: [ValueTracking] Replace an always false condition with an assert. NFC

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

Added: 
    

Modified: 
    llvm/lib/Analysis/ValueTracking.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index c86a70c76bc5d..05b802cfd8480 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -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;


        


More information about the llvm-commits mailing list