[llvm-dev] Induction variable identification?

Ehsan Amiri via llvm-dev llvm-dev at lists.llvm.org
Sun Oct 16 09:48:12 PDT 2016


If you have a canonicalized IV, you can use
Loop::getCanonicalInductionVariable() declared in
"include/llvm/Analysis/LoopInfo.h".

Otherwise you probably need to start from  function simplifyLoopIVs() in
"lib/Transforms/Utils/SimplifyIndVar.cpp". This method looks at all phi
nodes in the header of the loop, but later on in the process, it skips some
of them. For example, when we reach SimplifyIndvar::simplifyUsers(), in the
beginning of this function we check if the IV data type isSCEVable() or
not. If not, we immediately return.

Hope that helps
Ehsan


On Sun, Oct 16, 2016 at 6:38 AM, Madhur Amilkanthwar via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Hi,
> How does LLVM identify induction variables of a loop?
> Is the algorithm based on SSA graphs?
>
> I have a complicated loop and I need to do some analysis around it.
> Can anyone please point me to source of identification part?
>
>
>
> --
> *Disclaimer: Views, concerns, thoughts, questions, ideas expressed in this
> mail are of my own and my employer has no take in it. *
> Thank You.
> Madhur D. Amilkanthwar
>
>
> _______________________________________________
> 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/20161016/23f88a0d/attachment.html>


More information about the llvm-dev mailing list