[llvm] r303425 - [LoopPredication] NFC. Extract CanExpand helper lambda
Artur Pilipenko via llvm-commits
llvm-commits at lists.llvm.org
Fri May 19 07:00:04 PDT 2017
Author: apilipenko
Date: Fri May 19 09:00:04 2017
New Revision: 303425
URL: http://llvm.org/viewvc/llvm-project?rev=303425&view=rev
Log:
[LoopPredication] NFC. Extract CanExpand helper lambda
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopPredication.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopPredication.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopPredication.cpp?rev=303425&r1=303424&r2=303425&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopPredication.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopPredication.cpp Fri May 19 09:00:04 2017
@@ -141,7 +141,11 @@ Optional<Value *> LoopPredication::widen
std::swap(LHSS, RHSS);
Pred = ICmpInst::getSwappedPredicate(Pred);
}
- if (!SE->isLoopInvariant(RHSS, L) || !isSafeToExpand(RHSS, *SE))
+
+ auto CanExpand = [this](const SCEV *S) {
+ return SE->isLoopInvariant(S, L) && isSafeToExpand(S, *SE);
+ };
+ if (!CanExpand(RHSS))
return None;
const SCEVAddRecExpr *IndexAR = dyn_cast<SCEVAddRecExpr>(LHSS);
@@ -170,7 +174,7 @@ Optional<Value *> LoopPredication::widen
DEBUG(dbgs() << "NewLHSS: ");
DEBUG(NewLHSS->dump());
- if (!SE->isLoopInvariant(NewLHSS, L) || !isSafeToExpand(NewLHSS, *SE))
+ if (!CanExpand(NewLHSS))
return None;
DEBUG(dbgs() << "NewLHSS is loop invariant and safe to expand. Expand!\n");
More information about the llvm-commits
mailing list