[llvm] r319306 - [SCEV][NFC] Break from loop after we found first non-Phi in getAddRecExprPHILiterally
Max Kazantsev via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 29 02:54:16 PST 2017
Author: mkazantsev
Date: Wed Nov 29 02:54:16 2017
New Revision: 319306
URL: http://llvm.org/viewvc/llvm-project?rev=319306&view=rev
Log:
[SCEV][NFC] Break from loop after we found first non-Phi in getAddRecExprPHILiterally
Modified:
llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp
Modified: llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp?rev=319306&r1=319305&r2=319306&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Wed Nov 29 02:54:16 2017
@@ -1143,7 +1143,11 @@ SCEVExpander::getAddRecExprPHILiterally(
for (auto &I : *L->getHeader()) {
auto *PN = dyn_cast<PHINode>(&I);
- if (!PN || !SE.isSCEVable(PN->getType()))
+ // Found first non-phi, the rest of instructions are also not Phis.
+ if (!PN)
+ break;
+
+ if (!SE.isSCEVable(PN->getType()))
continue;
const SCEVAddRecExpr *PhiSCEV = dyn_cast<SCEVAddRecExpr>(SE.getSCEV(PN));
More information about the llvm-commits
mailing list