Induction Variables vs Loop Control Variable

Hi all,
     I was wondering if its possible to identify loop control
variables from the induction variables in a Loop using LLVM.
Also, How does one can use the LoopInfo class to identify the natural
loops from the IR. In other words how to use the class in the pass?



I'd strongly suggest looking at some existing loop pass like LICM or loop strength reduction or induction variable simplification. Induction Variable Simplification specifically will show you how to rely on it and how to identifier induction variables.