[PATCH] [Polly] Extract number of elements/iterations for a isl_set/isl_ast_node

Tobias Grosser tobias at grosser.es
Thu Oct 9 23:26:16 PDT 2014


On 10.10.2014 04:08, Johannes Doerfert wrote:
> Lnt shows that sometimes it is very costly to compute the loop bounds. So I figure we cannot compute it for every loop but only on demand.

Thank you Johannes for running performance tests. That cost was what I 
was worried about.

> However, we need a fast way to compute hasAtLeastOneIteration(isl_ast_node *For). Any thoughts?

I am not sure. I was hoping we could just look at the schedule and will 
find a simple computation, but thinking about it this morning for a 
little, I did not really make progress.

I will CC Sven who may have an idea. (In fact it may even be that the 
isl ast generator is the best place to compute such information as it 
could possibly allow us to give a more precise answer).

@Sven: We are trying to compute if a certain for node in the isl ast 
will always execute its first iteration. This is very useful, as knowing
this we can write the loop as:

do {
   body
   inc;
} while(cond)

This new forms is better than a normal loop, as LLVM now also knows the 
loop is executed at least once and consequently knows that it is save to
move loop invariant loads out of the loop.

Cheers,
Tobias













More information about the llvm-commits mailing list