[PATCH] D63304: Ignore Singletons in statement domains

Sameer AbuAsal via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 14 10:31:17 PDT 2019


sabuasal marked 2 inline comments as done.
sabuasal added a comment.

In D63304#1543859 <https://reviews.llvm.org/D63304#1543859>, @sabuasal wrote:

> In D63304#1542864 <https://reviews.llvm.org/D63304#1542864>, @Meinersbur wrote:
>
> > Thanks for the patch. Do you happen to have performance, code size numbers?
> >
> > [suggestion] The algorithm for detecting non-looping basic sets is quite ISL-heavy. If the goal is to better handle loops such as
> >
> >   i = 0;
> >   do {
> >     Stmt(i)
> >   } while (++i <n)
> >
> >
> > did you think about recognizing them directly? 
> >  Another possibility would be to merge the singleton with the main loop. E.g. the loop above could be converted into
> >
> >   for (int i = 0; i < max(1,n); i+=1) 
> >     Stmt(i);
> >
>


You can detect this simple loop domain directly by using "is_singleton" but with nested loops you'll need to project out to find singletons in one dimension out of all the loop nest dimensions.

As for numbers, we observed code size saving of around 1 MB when compiling a version of android Q.



================
Comment at: include/polly/ScopInfo.h:69
   DELINEARIZATION,
+  UPPERBOUND,
 };
----------------
Meinersbur wrote:
> Can you use something more descriptive?
Hmm, I'll change to TRIPCOUNT , how does that sound?


================
Comment at: lib/Analysis/ScopInfo.cpp:195
+static cl::opt<bool>
+    HandleDoWhile("polly-model-do-while",
+                  cl::desc("Prune exeution domain of statements to ignore"
----------------
Meinersbur wrote:
> Can you explain the why you chose the name `model-do-while`?
The problem with disjunction in domains is very common in *do while* style loops  where the domain of the statement has either one iteration (if the loop condition is false) or more than one. 

The idea in this patch is that if the loop condition is actually false we should really not try to run the transformed version of the loop anyway since it not beneficial for a loop of 1 iteration.

I am open t other names if you have suggestions :)


Repository:
  rPLO Polly

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63304/new/

https://reviews.llvm.org/D63304





More information about the llvm-commits mailing list