[PATCH] D12950: [SCEV] Teach isLoopBackedgeGuardedByCond to exploit trip counts.
hfinkel@anl.gov via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 23 01:05:53 PDT 2015
hfinkel added inline comments.
================
Comment at: lib/Analysis/ScalarEvolution.cpp:7008
@@ -7007,1 +7007,3 @@
+ // See if we can exploit an already computed trip count to prove the
+ // predicate.
----------------
already computed => already-computed
================
Comment at: lib/Analysis/ScalarEvolution.cpp:7010
@@ +7009,3 @@
+ // predicate.
+ auto BECountIt = BackedgeTakenCounts.find(L);
+ if (BECountIt != BackedgeTakenCounts.end()) {
----------------
It seems like we should add a comment in ScalarEvolution.h somewhere that isLoopBackedgeGuardedByCond will potentially-return more-accurate answers if you compute the look trip count first.
This seems unfortunate, but I suppose we can't force the trip-count computation here because we might infinitely recurse?
================
Comment at: lib/Analysis/ScalarEvolution.cpp:7019
@@ +7018,3 @@
+ const SCEV *LoopCounter =
+ getAddRecExpr(getZero(Ty), getOne(Ty), L, SCEV::FlagAnyWrap);
+ if (isImpliedCond(Pred, LHS, RHS, ICmpInst::ICMP_ULT, LoopCounter,
----------------
Don't we know that SCEV::FlagNW | SCEV::FlagNUW here? Otherwise, it would not really be a trip count, would it?
http://reviews.llvm.org/D12950
More information about the llvm-commits
mailing list