[PATCH] D143677: [ValueTracking] Replace an always true condition with an assert.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 9 13:14:30 PST 2023


craig.topper created this revision.
craig.topper added reviewers: spatel, nikic, lebedev.ri.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D143677

Files:
  llvm/lib/Analysis/ValueTracking.cpp


Index: llvm/lib/Analysis/ValueTracking.cpp
===================================================================
--- llvm/lib/Analysis/ValueTracking.cpp
+++ llvm/lib/Analysis/ValueTracking.cpp
@@ -2302,8 +2302,7 @@
 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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143677.496221.patch
Type: text/x-patch
Size: 576 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230209/9cff3e82/attachment.bin>


More information about the llvm-commits mailing list