[PATCH] Loop Rerolling Pass

Hal Finkel hfinkel at anl.gov
Thu Oct 17 07:02:12 PDT 2013


----- Original Message -----
> 
> 
> 
> On Oct 16, 2013, at 6:25 PM, Andrew Trick < atrick at apple.com > wrote:
> 
> 
> 
> 
> But it seems, that being the case, we could still return 'n/5' for
> loops with only one exiting block? I thought that is what
> SE->hasLoopInvariantBackedgeTakenCount(L) was for. It would only say
> that there was a backedge-taken count if the loop structure was
> simple enough that there was one unambiguous answer. Is this just an
> implementation oversight, or are there additional complications?
> 
> 
> 
> 
> So you could get a minimum taken count for a particular loop back
> edge in this case if we adapt the SCEV API to communicate properly.
> 
> I recall discussing this before, and so I apologize, but can you
> elaborate on what 'communicate properly' will entail?
> 
> I’m open to anything. For each branch exit we could distinguish
> between a min vs. exact backedge taken count.
> 
> Minimum taken count is the wrong term. We have either an
> “exact-may-exit” count or an “exact-must-exit” count. The
> implication of exact-may-exit is that either:
> - the loop exits at this iteration
> - the loop exits at a later iteration via another exit
> - the loop terminates at a later iteration
> - the loop exhibits undefined behavior (at a later iteration)
> 
> 
> Of course, in either case, the loop may exit earlier via another exit
> or terminate early.

This makes sense. Maybe something as simple as getBackedgeTakenCount(bool MayExitElsewhere = true)?

 -Hal

> 
> 
> -Andy

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory




More information about the llvm-commits mailing list