[llvm-dev] loop canonical variables

Michael Kruse via llvm-dev llvm-dev at lists.llvm.org
Tue Jul 25 11:42:42 PDT 2017

2017-07-25 19:32 GMT+02:00 Anastasiya Ruzhanskaya
<anastasiya.ruzhanskaya at frtk.ru>:
> I call this function and it returns only "i" in my example.  Are there any
> ways to return "j" also?

That would contradict it being the /canonical/ induction variable, wouldn't it?

If you look into the imlplementation of
getCanonicalInductionVariable(), it just walks the IR instructions and
checks some conditions. You can have your own implementation that,
instead of returning the first matching PHI, return all matching PHIs.
SimplifyIndVar won't try to canonicalize, though.


More information about the llvm-dev mailing list