[llvm] 46a1dd4 - [SCEV][NFC] Reorder checks to delay call of all_of

Max Kazantsev via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 13 23:31:27 PDT 2021


Author: Max Kazantsev
Date: 2021-10-14T13:30:51+07:00
New Revision: 46a1dd47e630c0c528bfc02cf7c77160a7488017

URL: https://github.com/llvm/llvm-project/commit/46a1dd47e630c0c528bfc02cf7c77160a7488017
DIFF: https://github.com/llvm/llvm-project/commit/46a1dd47e630c0c528bfc02cf7c77160a7488017.diff

LOG: [SCEV][NFC] Reorder checks to delay call of all_of

Check lightweight getter condition before calling all_of.

Added: 
    

Modified: 
    llvm/lib/Analysis/ScalarEvolution.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index d8d39307adcfb..71b67dc683b2e 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -7681,7 +7681,7 @@ ScalarEvolution::BackedgeTakenInfo::getConstantMax(ScalarEvolution *SE) const {
     return !ENT.hasAlwaysTruePredicate();
   };
 
-  if (any_of(ExitNotTaken, PredicateNotAlwaysTrue) || !getConstantMax())
+  if (!getConstantMax() || any_of(ExitNotTaken, PredicateNotAlwaysTrue))
     return SE->getCouldNotCompute();
 
   assert((isa<SCEVCouldNotCompute>(getConstantMax()) ||


        


More information about the llvm-commits mailing list