[llvm-dev] loop induction variables at IR level

Hal Finkel via llvm-dev llvm-dev at lists.llvm.org
Sat Jul 1 06:54:32 PDT 2017

Hi, Archa,

What do you want to do with the induction variable? For most uses cases, 
you can use the ScalarEvolution analysis (and, if necessary, the 


On 07/01/2017 03:56 AM, Archa . via llvm-dev wrote:
> Hi,
> I was looking at trying to get loop induction variable at IR level. 
> LLVM documentation mentioned indvars pass and 
> getCanonicalInductionVariable() to get them, I tried running the 
> indvars pass and then a custom pass which iterates through loops and 
> uses the function to obtain variable for a simple loop program. But 
> the API returns null. I also read in similar posts that the indvars 
> pass is not available in the current version but documentation still 
> mentions them.
> Is there something I am missing in my method , or is there an 
> alternative method to get the induction variable in the latest version.
> Thanks in advance
> Regards
> Archa
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170701/2f1daeea/attachment-0001.html>

More information about the llvm-dev mailing list