Thanks Michael, I will go through the ScalarEvolution module in more detail.
Thanks and Regards
Sender : Michael Zolotukhin<firstname.lastname@example.org>
Title : Re: [LLVMdev] Question on Loop Normalization in LLVM
This is what SCEV (ScalarEvolution) does in LLVM, though it doesn’t have to be directly reflected in the IR.
SCEV analyzes the program and for all expressions in a loop tries to compute a descriptor of its behavior (called SCEV-expression). E.g for you first loop for induction variable it will compute a SCEV expression: <7,+,1>, which means an induction variable with start value 7 and positive stride 1. These expressions could be nested, i.e. start value could be an induction variable of outer loop, for instance. With this info, one don’t need to rewrite the loop IR unless it’s profitable for some other reason (e.g. Loop Strength Reduction, LSR, can do that to make code faster).