[llvm-dev] Induction variable identification?

Madhur Amilkanthwar via llvm-dev llvm-dev at lists.llvm.org
Mon Oct 17 05:11:01 PDT 2016


Thanks this helps!

On Sun, Oct 16, 2016 at 11:19 PM, Ehsan Amiri <ehsanamiri at gmail.com> wrote:

> To be clear, I was suggesting to read the code in simplifyLoopIVs() in
> "lib/Transforms/Utils/SimplifyIndVar.cpp" to see how it identifies IVs.
> (as opposed to calling the function to change the code).
>
> On Sun, Oct 16, 2016 at 12:48 PM, Ehsan Amiri <ehsanamiri at gmail.com>
> wrote:
>
>> 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
>>>
>>>
>>
>


-- 
*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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161017/ee86cfa2/attachment.html>


More information about the llvm-dev mailing list