[llvm-dev] ind variable

Anastasiya Ruzhanskaya via llvm-dev llvm-dev at lists.llvm.org
Wed Aug 9 06:08:22 PDT 2017


Could you also please share , how to process SCEV - it dump useful
information , but can I somehow extract for example that basic block, which
it is mentioning?

2017-08-09 14:57 GMT+02:00 Anastasiya Ruzhanskaya <
anastasiya.ruzhanskaya at frtk.ru>:

> ...or maybe the second operand of ICmp
>
> 2017-08-09 14:51 GMT+02:00 Anastasiya Ruzhanskaya <
> anastasiya.ruzhanskaya at frtk.ru>:
>
>> SCEV , seems to me that this is a little disadvantage ( I am not an
>> expert by now in llvm, but think so), does not keep a cmp instruction,
>> where someone can find a value , with which an induction variable is
>> compared. When it is impossible to determine a trip count, that information
>> can be useful ( hope not only for me). Still after receiving a block where
>> this instruction is, it is not really hard to find the ICmp, but still...
>>
>> 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/rLEGUP54ca7c2bb15d84116baf47bce6725
>>> 6d3803720d9
>>> > .
>>> > 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
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170809/d67a669b/attachment.html>


More information about the llvm-dev mailing list