[PATCH] D17201: [SCEV] Introduce a guarded backedge taken count and use it in LAA and LV

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 22 08:01:57 PST 2016


sanjoy added inline comments.

================
Comment at: lib/Analysis/ScalarEvolution.cpp:5683
@@ -5607,1 +5682,3 @@
+  // Try to compute it using assumptions.
+  return computeExitLimitFromICmp(L, ExitCond, TBB, FBB, ControlsExit, true);
 }
----------------
sbaranga wrote:
> sanjoy wrote:
> > I don't think this is the right layering -- for instance, this forces SCEV clients that don't want speculative / predicated trip counts to pay to cost of computing them.
> > 
> > I'd say SCEV users that care about predicated trip counts should do this retry themselves, i.e. something like
> > 
> > ```
> > const SCEV *TC = getBackedgeTakenCount(L);
> > if (TC is SCEVCouldNotCompute) {
> >   SE->forgetLoop(L);
> >   TC = getPredicatedBackedgeTakenCount(L);
> > }
> > ```
> > 
> Good point. I'll look into how we could compute this more lazily.
> 
> Why do you think we would need a SE->forgetLoop() here? FWIW I'm generally trying to avoid having to invalidate the analysis for a given loop.
> Why do you think we would need a SE->forgetLoop() here?

To forget the cached CouldNotCompute trip count.  But you're right -- we're probably better off not invalidating the whole analysis -- we can just have the second call to `getPredicatedBackedgeTakenCount` overwrite CouldNotCompute.


http://reviews.llvm.org/D17201





More information about the llvm-commits mailing list