[llvm] r310493 - [ValueTracking] Turn a test into an assertion.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 9 09:06:54 PDT 2017


Author: davide
Date: Wed Aug  9 09:06:54 2017
New Revision: 310493

URL: http://llvm.org/viewvc/llvm-project?rev=310493&view=rev
Log:
[ValueTracking] Turn a test into an assertion.

As discussed with Chad, this should never happen, but this
assertion is basically free, so, keep it around just in case.

Modified:
    llvm/trunk/lib/Analysis/ValueTracking.cpp

Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=310493&r1=310492&r2=310493&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Wed Aug  9 09:06:54 2017
@@ -4531,9 +4531,7 @@ static Optional<bool> isImpliedCondAndOr
           LHS->getOpcode() == Instruction::Or) &&
          "Expected LHS to be 'and' or 'or'.");
 
-  // The remaining tests are all recursive, so bail out if we hit the limit.
-  if (Depth == MaxDepth)
-    return None;
+  assert(Depth <= MaxDepth && "Hit recursion limit");
 
   // If the result of an 'or' is false, then we know both legs of the 'or' are
   // false.  Similarly, if the result of an 'and' is true, then we know both




More information about the llvm-commits mailing list