[llvm-dev] Handling case when getCanonicalInductionVariable() returns NULL

Alex Susu via llvm-dev llvm-dev at lists.llvm.org
Sat Mar 18 10:06:19 PDT 2017


   Hello.
      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,
     Alex


More information about the llvm-dev mailing list