[PATCH] D43876: [LoopUnroll] Peel off iterations if it makes conditions true/false.
Jun Bum Lim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 7 13:28:11 PST 2018
junbuml added a comment.
> I am open for suggestions. I think peeling off iterations at the end as Roman suggested might be worthwhile too. And opportunistically peeling off a few iterations, if the distance between start and end are low, but unrolling does not apply.
Peeling off iterations at the end might hit the case I'm trying to optimize. I will be happy to support it.
================
Comment at: lib/Transforms/Utils/LoopUnrollPeel.cpp:169
+ CmpInst::Predicate Pred;
+ if (!Condition ||
+ !match(Condition, m_ICmp(Pred, m_Value(LeftVal), m_Value(RightVal))))
----------------
Isn't it okay to remove this nullcheck for Condition ?
================
Comment at: lib/Transforms/Utils/LoopUnrollPeel.cpp:192
+ Pred = ICmpInst::getSwappedPredicate(Pred);
+ while (DesiredPeelCount < MaxPeelCount &&
+ SE.isKnownPredicate(Pred, IterVal, RightSCEV)) {
----------------
Do we really need this loop. Isn't it possible to find the count using getMinusSCEV(RightSCEV, LeftSCEV->getStart()) as long as getMinusSCEV(RightSCEV, LeftSCEV->getStart()) is constant ?
https://reviews.llvm.org/D43876
More information about the llvm-commits
mailing list