Handling case when getCanonicalInductionVariable() returns NULL

      Is there a way to obtain an llvm::Loop induction variable when getCanonicalInductionVariable() returns NULL? This happens, for example, when we have induction variables with non-unit step for loops like:
        for (row = 0; row < size; row += 2).
     It seems that using parameters for opt like -indvars (I also disabled it some time ago in PassManagerBuilder, but I made sure I re-enabled it), -mem2reg, -loop-simplify do not help. (I got inspired from other mail threads like https://groups.google.com/forum/#!topic/llvm-dev/2xZAuiY9s_o OR http://stackoverflow.com/questions/13831678/using-indvars-optimization-pass-for-finding-canonical-induction-variable-in-llvm ).

     I'm thinking to create my own method similar to Loop::getCanonicalInductionVariable() (from http://llvm.org/docs/doxygen/html/LoopInfo_8cpp_source.html#l00112 ).
     But otherwise am I missing something?

   Thank you,

In general, the only way to obtain an induction variable for a loop is to generate it yourself; there is no general guarantee that a loop has an induction variable, and there is no optimization which produces them (except for LSR). If you have a SCEV expression, you can use ScalarEvolutionExpander to get a Value* for a SCEV expression.

What are you trying to do?