[llvm-dev] ind variable

Tobias Grosser via llvm-dev llvm-dev at lists.llvm.org
Mon Aug 14 00:01:28 PDT 2017


In certain rare (but AFAIR important) cases the indvar canonicalization
reduced performance and LLVM was not successful in recovering the
optimal IR during later strength reduciton passes.

Best,
Tobias

On Sun, Aug 13, 2017, at 18:46, Anastasiya Ruzhanskaya via llvm-dev
wrote:
> Could you please clarify for me: was the elimination of this pass also
> due
> to some performance issues? So, if I will insert this pass  now and
> perform
> modification of the graph, will be there any performance impact?
> 
> 2017-08-09 14:28 GMT+02:00 Tobias Grosser <tobias.grosser at inf.ethz.ch>:
> 
> > This support was removed years ago from indvars. We don't need canonical
> > induction variables any more as all analysis are done on SCEVs. The SCEV
> > generator can transform them even without the need for explicit
> > canonical induction variables.
> >
> > Best,
> > Tobias
> >
> > On Wed, Aug 9, 2017, at 14:23, Anastasiya Ruzhanskaya via llvm-dev
> > wrote:
> > > The files of this strange pass are described here
> > > http://reviews.legup.org/rLEGUP54ca7c2bb15d84116baf47bce67256d3803720d9
> > > .
> > > I wonderwhy the most uptodate -indvars pass can't do the same.
> > >
> > > 2017-08-09 14:18 GMT+02:00 Anastasiya Ruzhanskaya <
> > > anastasiya.ruzhanskaya at frtk.ru>:
> > >
> > > > Hello,
> > > > I have this piece of code:
> > > > int main() {
> > > >         int m = 0;
> > > > //      int i, j, k;
> > > > //      int N = f()%10;
> > > >         for (int l = 0; l < 1000; l+=4)
> > > >                 printf("%d", l);
> > > >
> > > > I am sure, that llvm is capable to convert this into canonical
> > induction
> > > > variable, but even with O3
> > > > define i32 @main() #0 {
> > > >   br label %2
> > > >
> > > > ; <label>:1                                       ; preds = %2
> > > >   ret i32 0
> > > >
> > > > ; <label>:2                                       ; preds = %0, %2
> > > >   %l.01 = phi i32 [ 0, %0 ], [ %4, %2 ]
> > > >   %3 = tail call i32 (i8*, ...) @printf(i8* nonnull getelementptr
> > inbounds
> > > > ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %l.01)
> > > >   %4 = add nuw nsw i32 %l.01, 4
> > > >   %5 = icmp slt i32 %4, 1000
> > > >   br i1 %5, label %2, label %1
> > > > }
> > > >
> > > > I have this assembler.
> > > > I know there is indvars2 pass ( it is under llvm license but used only
> > in
> > > > LegUp project - as I understood, surfing the Internet), which is good
> > in
> > > > changing induction variables.
> > > >
> > > > How can I achieve that this cycle will have a canonical indvar?
> > > >
> > > _______________________________________________
> > > LLVM Developers mailing list
> > > llvm-dev at lists.llvm.org
> > > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
> >
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


More information about the llvm-dev mailing list